General ⇒ Modify file names in a command definition
Modify file names in a command definition
When included, the image file has the same file stem as a the included .tex file (e.g. exclusions.tex and exclusions.jpg).
Rather than pass in both file names, It would be more elegant and less error prone if I could pass a single argument to the new command and generate the file names from that, for example, if I pass in donorItems as a file stem and generate donorItems.tex and donorItems.jpg to use within the command. However, I have not been able to see how this can be done.
Is someone able to suggest a way this might be accomplished, or suggest an alternative way to achieve the same result?
Thank you.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Modify file names in a command definition
Modify file names in a command definition
I believe what you want might be easily possible. However, I didn't really understand your aim. What Do you mean by “generate”? The files themselves should be generated through TeX? Or are they present already but you want to include them? The latter would be as easy asnormanj wrote:for example, if I pass in donorItems as a file stem and generate donorItems.tex and donorItems.jpg to use within the command.
Code: Select all
\newcommand*\myinclude[1]{%
\input{#1.tex}\par
\inlcudegraphics{#1.jpg}%
}
\myinclude{donoritems}
Modify file names in a command definition
Thanks again