0

In a document with the exam class and \printanswers, the borders of the solution are ignored and the frame is being printed over.

How could I fix this? (dropping the \extrawidth did not fix the problem, but it's better visible that way)

MWE: MWE

\documentclass[a4paper]{exam}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\extrawidth{-1cm}
\printanswers

\begin{document}
\begin{questions}
\begin{question}
\begin{parts}

\part Blah
\begin{solution}
    für 2NF: Aufteilen des Relationenschemas, so dass die gefundenen Teilabhängigkeiten nicht mehr auftreten können:
\end{solution}

\end{parts}
\end{question}
\end{questions}
\end{document}
6
  • 1
    try adding a few discretionary hyphens to "Teilabhängigkeiten". Nov 10, 2017 at 20:00
  • @barbara That would work around this example case, but not for all of the others. I was hoping for a more automated way, too :-)
    – hoeni
    Nov 10, 2017 at 20:04
  • note this is unrelated to the exam class, you would see the same in any document class if setting that text. Nov 10, 2017 at 20:16
  • I see it is a long word without break. But I'm trying to understand why the word is not wrapped into the next line if it doesn't fit? Just because it's long?
    – hoeni
    Nov 10, 2017 at 20:52
  • 1
    Tex's default settings do not allow it to over-stretch the white space that much so it gives up, complains about an over-full box in the log file and leaves it sticking out. You could allow the white space to stretch (\sloppy) but then the output looks pretty horrible. Nov 10, 2017 at 21:03

1 Answer 1

1

You (always) need to specify T1 font encoding otherwise you will not get correct hyphenation for non-ascii letters.

enter image description here

\documentclass[a4paper]{exam}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\extrawidth{-1cm}
\printanswers

\begin{document}
\begin{questions}
\begin{question}
\begin{parts}

\part Blah
\begin{solution}
    für 2NF: Aufteilen des Relationenschemas, so dass die gefundenen Teilabhängigkeiten nicht mehr auftreten können:
\end{solution}

\end{parts}
\end{question}
\end{questions}
\end{document}
2
  • Whoa, that fixes most of these problems in the document and even a lot more from my list to investigate later, thanks! :-) Yet still I don't understand why it does not wrap a line that could easily be wrapped :-)
    – hoeni
    Nov 10, 2017 at 20:59
  • 1
    @hoeni you were using the original 7bit font encoding for unaccented English, so no words can be hyphenated after an accented letter, so your text could not be wrapped as to do so without hyphenation would require over-stretching the white space. Nov 10, 2017 at 21:02

You must log in to answer this question.

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