这是上面问题的源码
documentclass{book}
usepackage{geometry}
geometry{a4paper,left=2cm,right=2cm,top=2.5cm,bottom=2.5cm} %landscape页面横制,twocolumn双栏
usepackage{ctex}
usepackage{tikz}
usepackage{amsmath}
usepackage{graphics}
usepackage{graphicx}
usepackage{enumitem}
usepackage{linegoal}
%选择题的4个选项,使用一个命令根据选项内容长度自动排版
usepackage{ifthen}
newlength{lab}
newlength{lb}
newlength{lc}
newlength{ld}
newlength{lhalf}
newlength{lquarter}
newlength{lmax}
newcommand{xx}[4]{mbox{}\[.5pt]%
\settowidth{\lab}{A.~#1~~~}
\settowidth{\lb}{B.~#2~~~}
\settowidth{\lc}{C.~#3~~~}
\settowidth{\ld}{D.~#4~~~}
\ifthenelse{\lengthtest{\lab > \lb}} {\setlength{\lmax}{\lab}} {\setlength{\lmax}{\lb}}
\ifthenelse{\lengthtest{\lmax < \lc}} {\setlength{\lmax}{\lc}} {}
\ifthenelse{\lengthtest{\lmax < \ld}} {\setlength{\lmax}{\ld}} {}
\setlength{\lhalf}{0.5\linewidth}
\setlength{\lquarter}{0.25\linewidth}
\ifthenelse{\lengthtest{\lmax > \lhalf}} {\noindent{}A.~#1 \\ B.~#2 \\ C.~#3 \\ D.~#4 } {
\ifthenelse{\lengthtest{\lmax > \lquarter}} {\noindent\makebox[\lhalf][l]{A.~#1~~~}%
\makebox[\lhalf][l]{B.~#2~~~}\\%
\makebox[\lhalf][l]{C.~#3~~~}%
\makebox[\lhalf][l]{D.~#4~~~}}%
{\noindent\makebox[\lquarter][l]{A.~#1~~~}%
\makebox[\lquarter][l]{B.~#2~~~}%
\makebox[\lquarter][l]{C.~#3~~~}%
\makebox[\lquarter][l]{D.~#4~~~}}}}
newcommand{kh}{hfillmakebox{(hspace*{2em})}}
begin{document}
begin{enumerate}
item 你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好kh
xx{arg1}{arg2}{arg3}{arg4}
item 你好kh
xx{arg1}{arg2}{arg3}{arg4}
item 你好kh
begin{center}
\begin{tikzpicture}
\draw (0,0)--(3,2)--(5,0)--(0,0);
\end{tikzpicture}
end{center}
xx{arg1}{arg2}{arg3}{arg4}
end{enumerate}
end{document}