如何逐字包含文件內容?

如何逐字包含文件內容?

如何將文字檔案的內容逐字包含在我的乳膠文件中?

我嘗試過(文本文件不包含任何@)

\documentclass{article}
\begin{document}   
    \verb@
    \input{temp.txt}
    @
\end{document}

但我收到錯誤:\verb ended by end of line.

PS:當然,即使沒有錯誤,上面也無法工作,因為如果它工作,輸出檔案將只包含單行\input{temp.txt}

答案1

嘗試

\documentclass[10pt]{article}

\usepackage{verbatim}

\begin{document}
\verbatiminput{temp.txt}
\end{document}

我經常使用它來包含TeX原始程式碼,因此許多不尋常的字元都得到了正確的處理 - 即字面上的字元。

相關內容