For one of the packages I'm making, I want to denote part problems in the left margin. I don't want to use e.g. \reversemarginpar since this is up to the user to define. Exercises are always going to be on the left margin.

I use the following code to put text in the left margin. It was from one of the answers here, but I can't seem to find it!

  % \steve (because I couldn't call it \mark, ref comments) 
  % will put 1b) into the left margin
        \vbox to 0pt{%
   \steve Once upon a different time\\%<- Works nicely
   \steve Once upon an equation \( \displaystyle\sum_{i=1}^{\infty} \)%<- Unaligned

The problem is that if it's used with lines which are very tall, e.g.


the alignment of the exercise mark, written by \steve, becomes unaligned with the equation, as demonstrated in the example.

My first thought was to create my own box that would work like the strutbox, but bigger:



(If you want to test this, put this above the first code, and replace \strut with \markstrut and \strutbox with \ppmarkbox)

However, this results in way to much whitespace above the lines of normal height.

Any ideas? Any better ways to mark the left margin?

  • 2
    are you sure you want to redefine \mark ? that will break all the section/page heading code. – David Carlisle Jun 25 '18 at 15:51
  • Woups - didn't think of. For the record though: it was just for the MWE. It's not called \mark in the prod-code, but something like \exercise@partproblem@headermargin, but that's a bit tedious for a MWE.. – Andreas Storvik Strauman Jun 25 '18 at 15:53
  • 2
    It isn't clear why you are using vadjust here rather than simply \def\dontcallmemark{\leavevmode\smash{\llap{\hdr}}} – David Carlisle Jun 25 '18 at 15:54
  • Took care of the \mark thing :) – Andreas Storvik Strauman Jun 25 '18 at 15:55
  • @DavidCarlisle It's because did something as crazy as copy paste from another answer that I can't seem to find! Would \leavevmode\smash{\llap{\hdr}} be sufficient?! – Andreas Storvik Strauman Jun 25 '18 at 15:56

You do not want \vadjust here as you want the mark to be on the baseline of the text, so simply


or more correct latex


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.