1

When I write between the 1st question and the 2nd question, I want to prevent the 2nd question from moving down. I want question 2 to remain fixed

Like this: enter image description here

\documentclass{exam}

\begin{document}

\begin{center}
\fbox{\fbox{\parbox{5.5in}{\centering
Answer the questions in the spaces provided. If you run out of room
for an answer, continue on the back of the page.}}}
\end{center}

\vspace{5mm}
\makebox[0.75\textwidth]{Name and section:\enspace\hrulefill}

\vspace{5mm}
\makebox[0.75\textwidth]{Instructor’s name:\enspace\hrulefill}
\begin{questions}

\question Is it true that \(x^n + y^n = z^n\) if \(x,y,z\) and \(n\) are positive integers?. Explain.
\vspace*{\stretch{1}}

\question Prove that the real part of all non-trivial zeros of the function \(\zeta(z)\) is \(\frac{1}{2}\)
\vspace{\stretch{1}}

\question Compute \[\int_{0}^{\infty} \frac{\sin(x)}{x}\]
\vspace{\stretch{1}}

\end{questions}
\clearpage
\end{document}
2
  • Remove the first \vspace*{\stretch{1}}. Replace it with \vspace*{<lenght>} to make room for the answer. Commented May 2, 2022 at 13:58
  • It didn't happen @SimonDispa
    – suarez
    Commented May 2, 2022 at 18:13

1 Answer 1

1

UPDATED

If you want question #2 to remain fixed on the page regardless of the text you type after the first question, you must reserve the space beforehand.

This example uses a minipage with a width of \textwidth and a height of 4\baselineskip, enough for four lines of text, as shown in the first page.

On the second page only 2 lines were written.

As you can see, the position of question #2 was not changed.

x

\documentclass{exam}

\begin{document}

\begin{center}
    \fbox{\fbox{\parbox{5.5in}{\centering
                Answer the questions in the spaces provided. If you run out of room
                for an answer, continue on the back of the page.}}}
\end{center}

\vspace{5mm}
\makebox[0.75\textwidth]{Name and section:\enspace\hrulefill}

\vspace{5mm}
\makebox[0.75\textwidth]{Instructor’s name:\enspace\hrulefill}
\begin{questions}
    
    \question Is it true that \(x^n + y^n = z^n\) if \(x,y,z\) and \(n\) are positive integers?. Explain.

    \begin{minipage}[][4\baselineskip][t]{\textwidth}
        First line.
        
        Second line.
        
        Third line.
        
        Fourth line.            
    \end{minipage}
    
    \question Prove that the real part of all non-trivial zeros of the function \(\zeta(z)\) is \(\frac{1}{2}\)
    
    \vspace{\stretch{1}}

    \question Compute \[\int_{0}^{\infty} \frac{\sin(x)}{x}\]

    \vspace{\stretch{1}}
    
\end{questions}

\clearpage

\begin{center}
\fbox{\fbox{\parbox{5.5in}{\centering
            Answer the questions in the spaces provided. If you run out of room
            for an answer, continue on the back of the page.}}}
\end{center}

\vspace{5mm}
\makebox[0.75\textwidth]{Name and section:\enspace\hrulefill}

\vspace{5mm}
\makebox[0.75\textwidth]{Instructor’s name:\enspace\hrulefill}
\begin{questions}

    \question Is it true that \(x^n + y^n = z^n\) if \(x,y,z\) and \(n\) are positive integers?. Explain.
    
    \begin{minipage}[][4\baselineskip][t]{\textwidth}
        First line.
        
        Second line.            
    \end{minipage}
    
    \question Prove that the real part of all non-trivial zeros of the function \(\zeta(z)\) is \(\frac{1}{2}\)
    
    \vspace{\stretch{1}}
    
    \question Compute \[\int_{0}^{\infty} \frac{\sin(x)}{x}\]
    
    \vspace{\stretch{1}}

\end{questions}
\end{document}

\begin{minipage}[position][height][inner-pos]{width}

There are three optional arguments: position, height, and inner-pos.

position governs how the minipage vertically aligns with the surrounding material.

height is a rigid length. It sets the height of the minipage.

The final optional argument inner-pos controls the placement of contents inside the box.

5
  • I didn't want that @Simon Dispa :(
    – suarez
    Commented May 2, 2022 at 21:00
  • @suarez Please explain in more detail. Commented May 2, 2022 at 21:25
  • When I write text between two questions, I want the position of the second question to remain fixed. I want to prevent the 2nd question option from moving down. @Simon Dispa
    – suarez
    Commented May 3, 2022 at 7:44
  • In other words: I want to split each column by two horizontally @Simon Dispa
    – suarez
    Commented May 3, 2022 at 7:53
  • 1
    @suarez Please see the updated answer. I will appreciate your comments. Commented May 3, 2022 at 16:51

Not the answer you're looking for? Browse other questions tagged .