如何在.tex或latex文件中插入实际或当前文件名(我在文件夹中保存的文件的名称)?

ped*_*dro 2 latex tex

如何在.tex或latex文件中插入实际或当前文件名(保存在文件夹中的文件的名称)?在Writer(OpenOffice)中,在脚或头文件中使用它是正常的,但在.tex文件中有没有办法做到这一点?我需要它在脚上打印.谢谢

小智 8

您可以使用currfile包.

以下是将当前文件名一般放入文档的方法:

\documentclass{article} 
\usepackage{currfile}

\title{Article}
\author{Author}
%\date{} 

\begin{document}
\maketitle

The current file is: \currfilename.\\

\end{document}
Run Code Online (Sandbox Code Playgroud)

以下是如何将当前文件名放在页脚中:

\documentclass{article} 
\usepackage{currfile}

\title{Article}
\author{Author}
%\date{} 

\usepackage{fancyhdr}
\pagestyle{plain}
\renewcommand{\headrulewidth}{0pt}  %get rid of header
\fancyfoot[L]{\currfilename} %put current file in footer

\begin{document}
\maketitle
\thispagestyle{fancy}% sets the current page style to 'fancy'

Your text goes here.\\

\end{document}
Run Code Online (Sandbox Code Playgroud)