0

So I just began using LaTeX, and I can’t figure out how to get my text right under this section header that my teacher made.

\newcommand{\additionalanswerspace}[1]{
\afterquestionvskip
\begin{center}
    \textbf{CONTINUE YOUR ANSWER TO #1 BELOW THIS LINE } \\ 
    \hrulefill
    \pagebreak
\end{center}}

I started to type underneath the additionalanswerspace command like this

\additionalanswerspace 
test test test

This resulted in my words being displayed on the next page. I figure it’s because of the \pagebreak my teacher included in the \additionalanswerspace command.

Essentially, I want to make it so that his command adds a page break after the text that I write. How should I go about doing this?

4
  • Welcome! Please provide a complete example rather than a fragment of code. But why can't you just write your text and then say \newpage? The above doesn't look as if it is intended for use when you are using LaTeX to write the answers, but probably if you are filling them in by hand after printing.
    – cfr
    Sep 11, 2016 at 3:28
  • But in most cases \pagebreak won't result in a page break. It is just a suggestion.
    – cfr
    Sep 11, 2016 at 3:29
  • surely you are supposed to answer the question replacing the \additionalanswerspace command, which is just a place holder until an answer is there? Sep 11, 2016 at 8:37
  • @cfr \pagebreak is more than a suggestion, it makes it infinitely bad not to break there. Sep 11, 2016 at 8:38

1 Answer 1

1

If you want to keep that header your teacher made but want to type the answer text in latex you have essentially 2 options the way I see it: Either remove the \pagebreak from your teachers command or make a new environment. To create an environment

\newenvironment*{additionalanswerspace}[1]{\afterquestionvskip
    \begin{center}
    \textbf{CONTINUE YOUR ANSWER TO #1 BELOW THIS LINE } \\ 
    \hrulefill}
    {\end{center}\pagebreak}

Then you can replace calls to \additionalanswerspace with

\begin{additionalanswerspace}{theanswer}
Answer text goes here
\end{additionalanswerspace}

This is only necessary if you want to keep the pagebreak i.e. put everything after the answer on a newpage. Otherwise simply removing the pagebreak from the original command is surely the prefered method.

You must log in to answer this question.

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