开发者

Passing command-line arguments to LaTeX document

I have a LaTeX file, 'myfile.tex' say, that sometime in the middle of the code an ASCII file with LaTeX macros has to be input, 'macrofile.tex, say, through an '\input{macrofile}' command. Actually, there are more than one 'macrofiles', so every time I have to edit 'myfile' and change the name of 'macrofile'. I can avoid the edit part by using a \typein command, yet, I'd still have to enter the name from the keyboard. Is there any way t开发者_开发问答o do that from the command line? So, to summarize, 'myfile.tex' looks like:

\documentclass{article}
........................
.......................
.......................
\begin{document}
.......................
......................
.......................
.......................
........................
.......................
\input{macrofile1} OR {macrofile2} OR {macrofile3} ETC...
.......................
......................
......................
....................
.....................
\end{document}

Can I pass the name of 'macrofile' as an argument to 'myfile.tex'?

Thanks

John


Yup, something like:

latex "\def\myvar{info-to-pass} \input{<filename>}"

should do you. You can then use \myvar in your document.

The \input{...} specifies the filename for the latex command.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜