文章占据一行时,选择题的括号如何在第二行自动居右排列?

发布于 2021-11-04 11:04:40
关注者
0
被浏览
999
2 个回答
追逐
追逐 2021-11-04
这家伙很懒,什么也没写!

这是上面问题的源码
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}

zhixia
zhixia 2021-11-04
这家伙很懒,什么也没写!

试试这样

\documentclass{article}

\usepackage{ctex}

\begin{document}

\begin{enumerate}
  \item 和大家啊厉害李开复哈罗凯啊首发哈了咖啡了哈拉废话说了解放了的  \hspace*{\fill}\mbox{(\qquad)}
\end{enumerate}

\end{document}

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览