Quantcast
Channel: Active questions tagged starred-version - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 63

Why does \WithSuffix\providecommand overwrite command already defined by instance of thmtools's restatable environment?

$
0
0

Consider the output

Output of MWE

of this MWE:

\documentclass{book}\usepackage{amsthm}\usepackage{thmtools}\usepackage{suffix}\declaretheorem[numberwithin=chapter, style=plain,name=Theorem,refname={theorem,theorems},Refname={Theorem,Theorems}]{theorem}\begin{document}\chapter{Test Chapter}\begin{restatable}[Made-Up Theorem]{theorem}{MadeUpTheorem}    This is a made-up theorem.\end{restatable}Now, let's repeat the restatable theorem:\MadeUpTheorem*Next, let's try to define a new command if it has not yet been defined.\WithSuffix\providecommand\MadeUpTheorem*{ABC}Let's see what happens:\MadeUpTheorem*\textbf{Why does this output ABC? Why not the original theorem?}I thought providecommand only defined a command if it had not already been defined.\end{document}
  • (Optional) Q: Why does this output ABC? Why does it not again output the original made-up theorem?
  • Q: More importantly, how can I "redefine" \MadeUpTheorem* only if it has not been defined previously?

It seems that \providecommand overwrites the original definition of \MadeUpTheorem* even if it's already defined.

In my use-case, the original restatable will be in a different file than the calling of \MadeUpTheorem*. It is compiled using \include, but during intermediate compilations it is not included, hence not defined. But during the final compilation, it is included, and so "ABC" should not be printed.


Viewing all articles
Browse latest Browse all 63

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>