답변을 제공하는 짧은 질문에 라텍스 시험 수업을 사용하고 있습니다. 다음 코드 코드는 페이지의 전체 너비에 걸쳐 답변을 제공합니다. 내 선택에 따라(1인치, 2인치 등) 줄일 수 있도록 이 선의 너비를 제어하고 싶습니다.
\begin{document}
\begin{questions}
\question What is your name? \fillwithlines{3cm}
\end{questions}
\end{document}
예를 들어, 기존 코드에서 얻은 결과는 다음과 같습니다.
이와 관련하여 도움을 주시면 감사하겠습니다. 감사해요
답변1
의견에서 언급했듯이 minipage
환경을 사용하는 것이 아마도 가장 간단한 솔루션일 것입니다. 이 작업을 많이 수행하는 경우 minipage
명령 버전을 만들 수 있습니다 \fillwithlines
. 사용하지 않을 경우 기본값이 되는 선택적 너비 인수를 사용합니다 \linewidth
.
\documentclass{exam}
\NewDocumentCommand{\Fillwithlines}{O{\linewidth}m}{
\par\begin{minipage}{#1}
\fillwithlines{#2}
\end{minipage}}
\begin{document}
\begin{questions}
\question What is the answer to this question?
\Fillwithlines[3in]{1in}
\question What is the answer to this question?
\Fillwithlines{1in}
\end{questions}
\end{document}
답변2
이 코드는 선의 고정된 길이( )를 질문 앞에 설정할 수 있는 \hsize
사용자 정의 길이( )로 대체합니다.\linelength
\documentclass{exam}
%**************************************** added <<<<<<<<<<<<
\usepackage{xpatch}
\newlength{\linelength}
\setlength{\linelength}{\hsize}% default length
\makeatletter
\xpatchcmd{\do@fillwithlines}
{\hsize}{\linelength}{}{}
\makeatother
%****************************************
\begin{document}
\begin{questions}
\setlength{\linelength}{1.5in}% choose the line length <<<<<<<<<<<<<<<<<<<<
\question What is your name? \fillwithlines{3cm}
\setlength{\linelength}{2.5in}% choose the line length <<<<<<<<<<<<<<<<<<<<
\question What is your name? \fillwithlines{3cm}
\end{questions}
\end{document}