为什么这\newline
当使用(而不是^^J
)和 生成行时不起作用,\StrSubstitute
如下所示?谢谢
\documentclass{article}
\usepackage{xstring}
\begin{document}
\def\mystrings{\noindent\StrSubstitute{%
B; new; test old; found people; sun; atom; number; life}%
{; }{\noexpand\noexpand\noexpand\newline}}
\mystrings
% B
% new
% test old
% found people
% sun
% atom
% number
% life
\newwrite\file
\immediate\openout\file=mystrings.txt
\immediate\write\file{\mystrings}
\closeout\file
\end{document}
答案1
目前还不清楚你想要什么,但也许
\documentclass{article}
\begin{document}
\def\mystrings{ B; new; test old; found people; sun; atom; number; life}%
\newwrite\file
\immediate\openout\file=mystrings.txt
{\newlinechar=`;
\immediate\write\file{\mystrings}
}
\closeout\file
\end{document}
生成文件
B
new
test old
found people
sun
atom
number
life