我怎样才能在像这样的很长的列表中获取换行符1,2,3,...
?
\documentclass[a4paper]{article}
\usepackage{tikz}
\begin{document}
\let\mylist=\empty
\foreach \k in {1,...,44}{
\ifx\empty\mylist{} \xdef\mylist{\k}%
\else \xdef\mylist{\mylist,\,\k}%
\fi
}
\section{Overlapping}
mylist: \mylist
parbox: \parbox{0.8\linewidth}{\mylist}
minipage: \begin{minipage}{5cm} \mylist \end{minipage}
\end{document}
答案1
我相信还有更好的答案。我发现它和 moewe 之前提供的一样。请不要投票。
\documentclass[a4paper]{article}
\usepackage{tikz}
\begin{document}
\let\mylist=\empty
\foreach \k in {1,...,44}{
\ifx\empty\mylist{} \xdef\mylist{\k,}% <<<<<
\else
\xdef\mylist{\mylist\, \k,}% <<<<
\fi
}
\section{Overlapping}
mylist: \mylist
parbox: \parbox{0.5\linewidth}{\mylist}
minipage: \begin{minipage}{3cm} \mylist \end{minipage}
\end{document}