I have a command \point that adds a $\bigstar$ as a margin note using the marginnote package. But I want multiple stars next to each other if there are multiple \point in each line. So Hello \point\point world. Generates two $\bigstar$ in the margin note. For now, both stars are generated but I think they overlap each other and look like there was only one.

My idea was to use a counter that resets on each linebreak. But is this possible? I've found commands to execute a command at the beginning of a paragraph using \everypar. Is there a command to add something to every generated output line of the document?

1 Answer 1


Here is an alternative suggestion, that adds a test to \marginnote, if the last \marginnote has the same vertical position and in this case move the output by the width of a \bigstar to the right:


%\providecommand\@thirdofthree[3]{#3}% Already defined in LaTeX from 1998/03/20
      {\themn@abspage}{\noexpand\number\mn@lastxpos sp}}%
}{% extend \newmarginnote by the y pos
      {\themn@abspage}{\noexpand\number\mn@lastxpos sp}{\noexpand\number\mn@lastypos}}%
}{% the x pos is now the second of three arguments and the third is the y pos
}{% the page number is now the first of three arguments
\xapptocmd{\@mn@margintest}{% now add the y pos testing and the offset
    \edef\@mn@currxpos{\the\dimexpr \@mn@currxpos-\@mn@currmove\relax}%



Test\point Test\point

Test\point Test\point Test\point


result with up to three points

  • 1
    Very interesting. I suggest \providecommand instead of \def for \@firstofthree and the like. Some packages define them and usually they’re \long.
    – egreg
    Jan 18, 2023 at 14:56
  • @egreg You are right. Changed.
    – cabohah
    Jan 18, 2023 at 15:27
  • Sorry for not having upvoted earlier, but I was on the phone and already typing in the comment was a tough business. 😀
    – egreg
    Jan 18, 2023 at 15:29
  • @egreg Real multitasking!
    – cabohah
    Jan 18, 2023 at 15:30
  • @cabohah Thank you! It works perfectly!
    – Survari
    Jan 19, 2023 at 7:28

You must log in to answer this question.

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