cgnieder / xsim

eXercise Sheets IMproved
67 stars 23 forks source link

First line printed outside of environment #44

Closed noctux closed 5 years ago

noctux commented 5 years ago

Hello, thank you for the package!

I'm currently porting our exercises from exsheets to xsim, and noticed a strange behaviour. Up to now, we used the following structure for crossreferencing:

\begin{exTask}[name=Verarbeitung]\label{checksum}
...
\end{exTask}

However, with xsim, the label is not correctly set afterwards. However, it works when the \label command is placed on a new line. The problem seems to be that any content that is on the same line as the start of the environment is acutally emitted before the environment is started.

MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage{xsim,lipsum,xcolor}

\begin{document}

\begin{exercise}[subtitle=lipsum] ASDF
    \lipsum[1]
\end{exercise}

\end{document}

Output: 2019-04-01-123525_662x350_scrot

Thank your for your effort!

cgnieder commented 5 years ago

This is because the inside of an exercise is written to an external file. The reading mechanism cannot cope with stuff that is on the same line as \begin{exercise}. I am afraid I can't change this behaviour

cgnieder commented 5 years ago

This is actually mentioned in the manual but I will emphasize it in the next release!

noctux commented 5 years ago

Thank you for the explanation and for looking into it!