如何使 \newbox 尊重页边距

如何使 \newbox 尊重页边距

在此处输入图片描述我正在为学生编写数学练习教材,并打算在教材末尾提供答案。我试图使用一个包含所有解决方案的存储框来实现答案。但我无法让解决方案尊重段落。我非常感谢将答案页面分成两列。我知道我仍然排版得像个菜鸟。那是因为我已经学习了几个月的 LaTeX。很抱歉。无论如何,我会很感激任何帮助。

\documentclass[10pt]{exam}
\usepackage[hmargin=1.27cm,tmargin=1.37cm, bmargin=1.5cm]{geometry}
\usepackage{indentfirst}
\usepackage[brazil]{babel}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage[T1]{fontenc}
\usepackage{multicol, multirow, array, booktabs, adjustbox} % pacotes pra construção de tabelas
\setlength\extrarowheight{2pt} % define a altura de uma célula em uma tabela
\usepackage[utf8]{inputenc}



\renewcommand{\solutiontitle}{\noindent\textbf{$\;$}\enspace}


\printanswers
\unframedsolutions
% Box of all answers in the solution environment----------------------------

\newbox\allanswers
\setbox\allanswers\hbox{}

\renewenvironment{solution}{\global\setbox\allanswers=\hbox\bgroup\unhbox\allanswers}{\egroup}

\newcommand{\showallanswers}{\noindent\usebox\allanswers}
%----------------------------------------------------------------------------


\begin{document}

\begin{questions}

% Question 1--------------------------------------------------------------------

\question Os séculos são representados através de algarismos romanos. O século I iniciou-se no ano 1 da era cristã (A.D.), tendo como referência o nascimento de Jesus Cristo. O século XX encerrou-se em 2000, e século XXI começou a partir do ano 2001 e se encerrará no ano 2100, iniciando-se, em 2101, o século XXII.\\ Escreva a que século pertence:
\begin{parts}
\begin{minipage}{.48\linewidth}
\bigskip
\item o ano 1999;
\hrule width.9\textwidth
\begin{solution}
\textbf{\thequestion. }\textbf{\thepartno)} $XX$
\end{solution}
\bigskip
\item o ano 1851;
\hrule width.9\textwidth
\begin{solution}
\textbf{\thepartno)} $XIX$
\end{solution}
\bigskip 
\item o ano 1700;
\hrule width.9\textwidth
\begin{solution}
\textbf{\thepartno)} $XVII$
\end{solution}
\bigskip
\item o ano 345;
\hrule width.9\textwidth
\begin{solution}
\textbf{\thepartno)} $IV$
\end{solution}
\bigskip
\end{minipage}
\begin{minipage}{.48\linewidth}
\bigskip
\item o ano 1601;
\hrule width.9\textwidth
\begin{solution}
\textbf{\thepartno)} $XVII$
\end{solution}
\bigskip
\item o ano 598;
\hrule width.9\textwidth
\begin{solution}
\textbf{\thepartno)} $VI$
\end{solution}
\bigskip
\item o ano 33;
\hrule width.9\textwidth
\begin{solution}
\textbf{\thepartno)} $I$
\end{solution}
\bigskip
\item o ano 1201.
\hrule width.9\textwidth
\begin{solution}
\textbf{\thepartno)} $XIII$
\end{solution}
\bigskip
\end{minipage}
\end{parts} 
 
% Question 2------------------------------------------------------------------
 
\question Escreva os seguintes números usando símbolos romanos: 

\begin{parts}
\vspace{1mm}
\begin{minipage}{.48\linewidth}
\bigskip
\item 99
\begin{solution}
\textbf{\thequestion. }\textbf{\thepartno)} $XX$
\end{solution}
\hrule width.9\textwidth
\bigskip
\item 149
\begin{solution}
\textbf{\thepartno)} $XX$
\end{solution}
\hrule width.9\textwidth
\bigskip
\item 13
\begin{solution}
\textbf{\thepartno)} $XX$
\end{solution}
\hrule width.9\textwidth
\bigskip
\item 29
\begin{solution}
\textbf{\thepartno)} $XX$
\end{solution}
\hrule width.9\textwidth
\bigskip
\item 88
\begin{solution}
\textbf{\thepartno)} $XX$
\end{solution}
\hrule width.9\textwidth
\bigskip
\item 94
\begin{solution}
\textbf{\thepartno)} $XX$
\end{solution}
\hrule width.9\textwidth
\bigskip
\end{minipage}
\begin{minipage}{.48\linewidth}
\bigskip
\item 648
\begin{solution}
\textbf{\thepartno)} $XX$
\end{solution}
\hrule width.9\textwidth
\bigskip
\item 2103
\begin{solution}
\textbf{\thepartno)} $XX$
\end{solution}
\hrule width.9\textwidth
\bigskip
\item 781
\hrule width.9\textwidth
\bigskip
\item 302
\begin{solution}
\textbf{\thepartno)} $XX$
\end{solution}
\hrule width.9\textwidth
\bigskip
\item 1103
\begin{solution}
\textbf{\thepartno)} $XX$
\end{solution}
\hrule width.9\textwidth
\bigskip
\item 69
\begin{solution}
\textbf{\thepartno)} $XX$
\end{solution}
\hrule width.9\textwidth
\bigskip
\end{minipage}
\end{parts}

% Question 3-----------------------------------------------------------------

\question Determine o menor e o maior número de três algarismos diferentes que se pode escrever com os algarismos 0, 5, 6, 8 e 9. 
\fillwithlines{.7cm}
 \begin{solution}
\textbf{\thequestion. }$2135$ e $3216$
\end{solution}
\end{questions}

\begin{center}
Answer Key
\end{center}


\showallanswers% show all answers------------------------------------------------

\end{document}

答案1

为什么不尝试

\newcommand{\showallanswers}{\noindent\unhbox\allanswers}

代替

\newcommand{\showallanswers}{\noindent\usebox\allanswers}

避免过满

相关内容