
私は、回答用の行を提供する短い質問に LaTeX 試験クラスを使用しています。次のコード コードでは、ページの全幅にわたる回答用の行が表示されます。これらの行の幅を制御して、選択に応じて縮小できるようにしたいと考えています (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}