0

Is there a way in latex to use a command but redirect the output to another place in another .tex file?

Within commands.tex i defined the command \cmd which gets a three parameters. Within \cmd the command \ThisInAnotherTexFile is being used with the same parameters that has been given to \cmd. But the the output of \ThisInAnotherTexFile should not be where \cmd is being used but where i want it to be used. For example within a file called sum.tex.

I need it so i can automatically create a table by using only one command (\cmd) within sum.tex with the given parameters as content.

\newcommand{\cmd}[3]{
 Error: #1\\
 Descrition #2\\
 ShortDesc #3\\
 \ThisInAnotherTexFile{#1}{#2}{#3}
}
Radio
  • 11
  • 1
    well latex redirects lots of output. E.g. the table of contents is created by commands spread over the whole document. So yes you can do this, but your question is much to vage to be able to tell you what you should do exactly. Side remark: Don't use numbers in command names. – Ulrike Fischer Mar 17 '22 at 08:21
  • \newcommand{\cmd1} will already generate an error as you can not have numbers in command names. please edit the question to have a more realistic code that shows your issue, it is hard to guess from the current fragment – David Carlisle Mar 17 '22 at 08:31
  • 2
    Is this not a duplicate of https://tex.stackexchange.com/questions/637174/use-parameters-of-latexcommand-in-two-tex-files You can edit that post to clarify the question rather than re-post the same question. – David Carlisle Mar 17 '22 at 08:32

0 Answers0