![newwrite:将文本添加到现有的输出文件](https://linux22.com/image/411964/newwrite%EF%BC%9A%E5%B0%86%E6%96%87%E6%9C%AC%E6%B7%BB%E5%8A%A0%E5%88%B0%E7%8E%B0%E6%9C%89%E7%9A%84%E8%BE%93%E5%87%BA%E6%96%87%E4%BB%B6.png)
我有
\documentclass[a4paper]{article}
\begin{document}
\newwrite\myoutfile
\immediate\openout\myoutfile=\jobname-myoutfile.txt
\immediate\write\myoutfile{
aaa
}
\immediate\closeout\myoutfile
\section{Test: Input the Result}
\input{\jobname-myoutfile.txt}
\end{document}
这给了我外部jobname-myoutfile.txt
文件
aaa
里面。
我怎样才能bbb
向输出文件添加新文本(例如(以换行符!))?
这样我就会有
aaa
bbb
答案1
它应该像
\documentclass[a4paper]{article}
\begin{document}
\newwrite\myoutfile
\immediate\openout\myoutfile=\jobname-myoutfile.txt
\immediate\write\myoutfile{
aaa
}
\immediate\write\myoutfile{
bbb
}
\immediate\closeout\myoutfile
\section{Test: Input the Result}
\input{\jobname-myoutfile.txt}
\end{document}