I'd like to define a command \mark that would add an image mark.png :

  • on the same vertical coordinate than the current text
  • at 1cm from left border
  • without modifying the layout, i.e. if I remove this command, the text shouldn't move, the pages should have the same layout


Hello world
\mark Hello world


enter image description here

Expected behaviour:

enter image description here

Currently bad output:

enter image description here


You could place your image in the margin, this ensures that it does not influence the layout of the main text.

To do this you could use \marginpar{....} or as @Skillmon suggested in the comments \marginnote{} from the package of the same name for better placement.

Unrelated to the problem, but you should not use $$...$$, see Why is \[ ... \] preferable to $$ ... $$? for further information.



Hello world
Hello world

enter image description here

Since @samcarter allowed me to, here are some edits I'd use:

  1. I'd put the macro into a \begingroup-\endgroup pair and keep the \reversemarginpar into that group, so that we don't affect other macros using it.

  2. I'd put the \includegraphics into an \rlap so that it doesn't matter how wide the image is.

  3. I'd change the alignment of \marginnote put into the left margin locally.

Put into code:


Now you can use \mymark as you'd do with \includegraphics but putting the image into the margin.

Note: Don't forget to place it inside equations, if you want proper alignment:

 \[ \mymark x^2 +1 \]

works, whereas

 \mymark \[x^2 +1 \]

would produce a misalignment.

  • If the image is large (say, 10 cm), can it go behind the text, without modifying the text's position? – Basj Oct 19 '18 at 9:36
  • 1
    @Basj Yes, it is placed behind the text. It will cause an overfull box warning though. – samcarter is at topanswers.xyz Oct 19 '18 at 9:38
  • Also, could you just add a mention to explain what the reverse does? (\reversemarginpar) Thanks in advance! – Basj Oct 19 '18 at 9:38
  • 1
    @Basj You can adjust these spaces with the geometry package where you can set marginparwidth and marginparsep – samcarter is at topanswers.xyz Oct 19 '18 at 9:46
  • 1
    @Basj With the link to the other question I just wanted to show that if you want to annotate an equation, then the margin note should be placed there and not before the equation. – samcarter is at topanswers.xyz Oct 19 '18 at 15:18

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.