I want to print the filename of the file that I'm calling (\input{file_name}). Clearly this includes the file contents but is there anyway to get the corresponding filename to print as well?
Asked
Active
Viewed 836 times
1
LordStryker
- 1,036
-
1I think this might have the answer for you http://tex.stackexchange.com/questions/229813/how-can-i-print-the-filename-of-a-graphics-file-in-pdf – R. Schumacher Aug 13 '15 at 18:13
-
I don't know enough about LaTeX to translate the "includegraphics" code into "input". – LordStryker Aug 13 '15 at 18:30
1 Answers
4
Do the following:
\begin{filecontents}{testfile.tex}
\begin{itemize}
\item first
\item second
\item third
\end{itemize}
\end{filecontents}
\documentclass[10pt,letterpaper]{article}
\newcommand\Inputa[1]{\texttt{#1}\par\nobreak\input{#1}} % filename before
\newcommand\Inputb[1]{\input{#1}\par\nobreak\texttt{#1}} % filename after
\begin{document}
\begin{center}
\textbf{Just a Demonstration}
\end{center}
\textbf{Filename before the input}
\Inputa{testfile} % Only need extension if not 'tex'
\textbf{Filename after the input}
\Inputb{testfile.tex}
\end{document}
R. Schumacher
- 9,895
