Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

i'm having a hard time to figure out how to control the exact appearance of margin text (such as is output by the \marginpar command). i'm using XeLaTeX with packages such as geometry, fontspec, leading and have managed to gain fine control over issues such as font faces, font sizes, paragraph indentation and line spacing, including how to set margin width and the distance of the margins from the main text.

how can i control the font and paragraph formatting of margins?

share|improve this question
add comment

2 Answers

The LaTeX kernel uses \@marginparreset to set a fresh state in margin paragraphs. The usual definition is

\def\@marginparreset{%
  \reset@font
  \normalsize
  \@setminipage
}

and you can modify it setting the font you prefer. I'd suggest something like

\makeatletter
\def\@marginparreset{%
  \reset@font
  \normalsize
  \@marginparfont
  \@setminipage
}
\def\@marginparfont{\normalfont\itshape} % or whatever
\makeatother

With \normalfont you go in the default state and then you can add whatever specification you wish.

share|improve this answer
    
your answer implies using \makeatletter / \makeatother to allow for command names containing @, right? –  flow Mar 29 '13 at 23:08
    
@flow Yes; the two commands are not necessary only in .sty or .cls files. –  egreg Mar 29 '13 at 23:21
add comment

@egreg wow that was real fast, many thanks for your suggestion. i've had an idea in the meantime and came up with this:

\newcommand{\marge}[1]{\marginpar{\fontsize{2mm}{2mm}\leading{2.5mm}#1}}

(i'm using \leading here coz \fontsize on its own would not appear to set the line height right).

so far the above seems works to my satisfaction—is anyone aware of possible ungood side effects?

share|improve this answer
    
\leading probably corrects it but \fontsize{2mm}{2mm} sets a 2mm font on the same baseline, it's unusual to use mm for font sizes but no harm in it, but normally the baselineskip should be around 20% bigger than the font size. You then need \selectfont (which \leading also does) before \fontsize has any effect. –  David Carlisle Mar 30 '13 at 1:02
    
the thing is that the second argument to \fontsize would not appear to have any effect at all (pending more experiments), which is why i'm using \leading at all. –  flow Mar 30 '13 at 20:59
    
If you follow it by \selectfont and the paragraph ends within the scope of the change then it will have an effect, the whole of LaTeX's font machinery relies on that working... –  David Carlisle Mar 30 '13 at 21:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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