GeneralWhy do even pages have bad marginpar layout in twoside doc?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
yoyoimut
Posts: 120
Joined: Mon Oct 19, 2009 6:58 am

Why do even pages have bad marginpar layout in twoside doc?

Post by yoyoimut »

Hi everyone,

Please see my screen shot below to get the rough idea.
marginpar.jpg
marginpar.jpg (55.62 KiB) Viewed 3006 times
The even-numbered pages have bad marginpar layout. It is not the case for odd-numbered pages.


Do you have any idea to solve it?


Here is my minimal code snippet:

Code: Select all

\documentclass[a4paper,twoside,10pt]{book}
\usepackage[innermargin=25mm,outermargin=5mm,marginparwidth=50mm,includemp=true]{geometry}

\usepackage{xcolor,lipsum}

\newcommand{\mmp}[1]{\marginpar[\raggedleft\footnotesize\color{red}\fbox{\parbox{\marginparwidth}{\color{blue}#1}}]%
{\raggedright\footnotesize\color{blue}\fbox{\parbox{\marginparwidth}{\color{red}#1}}}}



\begin{document}
\lipsum[1]
\mmp{\LaTeXe\ is cool. However there are some bugs that can make you disappointed.} 
\lipsum[1-4]

\lipsum[1]
\mmp{\LaTeXe\ is cool. However there are some bugs that can make you disappointed.} 
\lipsum[1-5]
\end{document}
Thank you in advance.



regards,

Yoyo

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Why do even pages have bad marginpar layout in twoside doc?

Post by frabjous »

I think the problem is that you're trying to put an fbox around something that already takes up the entire width of the marginpar space, and this makes it overextend the space it's given -- LaTeX is overextending it to the right in both cases, and hence, when it's on the left of the text, it bumps into the text. When it's on the right, it just overextends further to the right than it's supposed to.

You'll see all is well if you either get rid of the \fbox command from the definition of \mmp, or change the width of the parbox to something that allows room for the frame (e.g., 4.5cm).
yoyoimut
Posts: 120
Joined: Mon Oct 19, 2009 6:58 am

Why do even pages have bad marginpar layout in twoside doc?

Post by yoyoimut »

frabjous wrote:I think the problem is that you're trying to put an fbox around something that already takes up the entire width of the marginpar space, and this makes it overextend the space it's given -- LaTeX is overextending it to the right in both cases, and hence, when it's on the left of the text, it bumps into the text. When it's on the right, it just overextends further to the right than it's supposed to.

You'll see all is well if you either get rid of the \fbox command from the definition of \mmp, or change the width of the parbox to something that allows room for the frame (e.g., 4.5cm).
OK. Thank you for your response.
I will get rid of the fbox and just use simple texts in marginpars.


regards,

Yoyo.
Post Reply