You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Stephen,
first of all, many thanks for your great package! It's superior to any other solution for positioning margin notes.
I've noticed the following problem: when marginfix is used, margin notes render with the color which was active at the beginning of the page. This is different from the way regular \marginpar works, and may lead to some unexpected behavior. Consider the following example of three paragraphs, each typeset with a different color and each containing a margin note.
As illustrated above, the colors of margin notes don't match the paragraph colors. Instead, the notes display in a color which is "carried over" from a previous context. I believe in most cases this is not the desired behavior. Rather, one would expect the notes to use the color which was active when they were defined. When I comment out \usepackage{marginfix}, the margin notes have the same color as the color of the paragraph in which they appear.
Any thoughts on how this issue could be resolved? Any help is highly appreciated!
Thanks,
Andrzej
The text was updated successfully, but these errors were encountered:
aoles
changed the title
Color of margin notes is not set properly
Color of margin notes not properly set
Jun 30, 2016
I was able to circumvent this issue by patching the internal LaTeX macro \@savemarbox to save the current color that is active when the box is build. This is achieved by enclosing the #2 argument in \color@setgroup and \color@endgroup, as illustrated below.
\documentclass{article}
\usepackage{blindtext}
\usepackage{color}
\usepackage{marginfix}
\makeatletter\long\def\@savemarbox #1#2{%\global\setbox #1%\color@vbox\vtop{%\hsize\marginparwidth\@parboxrestore\@marginparreset\color@setgroup#2\color@endgroup% save the currently active color\@minipagefalse\outer@nobreak
}%\color@endbox
}
\makeatother\begin{document}
\color{blue}
\blindtext\marginpar{Blue Note}
\blindtext\color{red}
\blindtext\marginpar{Red Note}
\blindtext\clearpage\color{green}
\blindtext\marginpar{Green Note}
\blindtext\end{document}
Do you think this patch could make it's way into marginfix?
Hi Stephen,
first of all, many thanks for your great package! It's superior to any other solution for positioning margin notes.
I've noticed the following problem: when marginfix is used, margin notes render with the color which was active at the beginning of the page. This is different from the way regular
\marginpar
works, and may lead to some unexpected behavior. Consider the following example of three paragraphs, each typeset with a different color and each containing a margin note.As illustrated above, the colors of margin notes don't match the paragraph colors. Instead, the notes display in a color which is "carried over" from a previous context. I believe in most cases this is not the desired behavior. Rather, one would expect the notes to use the color which was active when they were defined. When I comment out
\usepackage{marginfix}
, the margin notes have the same color as the color of the paragraph in which they appear.Any thoughts on how this issue could be resolved? Any help is highly appreciated!
Thanks,
Andrzej
The text was updated successfully, but these errors were encountered: