我想将文本文件导入到 Forest 中,并保持原样,而不使用 Latex 符号。我找到了verbatiminput
一种可能的选择,但它没有按我预期的方式工作,并输出了一些奇怪的字符:
以下是我的示例:
\documentclass{standalone}
\usepackage{forest}
\usepackage{xcolor}
\usepackage{adjustbox}
\usepackage{filecontents}
\usepackage{verbatim}
\begin{document}
\begin{forest}
[\verbatiminput{input.txt}]
\end{forest}
\end{document}
input.txt 包含以下文本:
I need to have as many ascii chars as possible without any conversion:
33 ! (exclamation mark)
34 " (Quotation mark)
35 # (Number sign)
36 $ (Dollar sign)
37 % (Percent sign)
38 & (Ampersand)
39 ' (Apostrophe)
40 ( (round brackets or parentheses)
41 ) (round brackets or parentheses)
42 * (Asterisk)
43 + (Plus sign)
44 , (Comma)
45 - (Hyphen)
46 . (Full stop , dot)
47 / (Slash)
58 : (Colon)
59 ; (Semicolon)
60 < (Less-than sign )
61 = (Equals sign)
62 > (Greater-than sign ; Inequality)
63 ? (Question mark)
64 @ (At sign)_
91 [ (square brackets or box brackets)
92 \ (Backslash)
93 ] (square brackets or box brackets)
94 ^ (Caret or circumflex accent)
95 _ (underscore , understrike , underbar or low line)
96 ` (Grave accent)
123 { (curly brackets or braces)
124 | (vertical-bar, vbar, vertical line or vertical slash)
125 } (curly brackets or braces)
126 ~ (Tilde ; swung dash)
输出:
答案1
您可以将的内容\verbatiminput
放入一个盒子中,然后在您不起眼的环境中使用这个盒子。
\documentclass{standalone}
\usepackage{forest}
\usepackage{verbatim}
\newbox\verbbox
\begin{document}
\setbox\verbbox=\vbox{\verbatiminput{input.txt}}
\begin{forest}
[\box\verbbox]
\end{forest}
\end{document}