将命令行参数传递给 LaTeX 文档
我有一个 LaTeX 文件,“myfile.tex”,有时在代码中间有一个带有 LaTeX 宏的 ASCII 文件 必须输入“macrofile.tex”,例如通过“\input{macrofile}”命令。实际上,有不止一个“宏文件”,所以每次我都必须编辑“myfile”并更改“宏文件”的名称。我可以避免 使用 \typein 命令编辑部分,但是,我仍然需要从键盘输入名称。有什么方法可以从命令行执行此操作吗?因此,总而言之,“myfile.tex”看起来像:
\documentclass{article}
........................
.......................
.......................
\begin{document}
.......................
......................
.......................
.......................
........................
.......................
\input{macrofile1} OR {macrofile2} OR {macrofile3} ETC...
.......................
......................
......................
....................
.....................
\end{document}
我可以将“macrofile”的名称作为参数传递给“myfile.tex”吗?
谢谢
约翰
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 to 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,类似这样的事情:
你应该这样做。然后您可以在文档中使用 \myvar。
\input{...}
指定latex
命令的文件名。Yup, something like:
should do you. You can then use \myvar in your document.
The
\input{...}
specifies the filename for thelatex
command.