TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to change the font, font size and so on for \marginpar with a standard LaTeX macro, i.e. without something such as \let\oldmarginpar\marginpar (cp. Problem with Customized Marginpar (in Combination With a ToMarginpar). The \marginnote package e.g. provides \marginfont.



Text text text\marginpar{A short note.}
share|improve this question
up vote 6 down vote accepted

To print out a margin the contents will be save in a savebox. So you can manipulate the default implementation of latex.ltx which is as follows:


The mandatory argument is the contents. So simple use:

  \@savemarbox\@marbox{\tiny #1}%

Based on the special symbol @ you have to use \makeatletter...\makeatother.

share|improve this answer

The easiest way is with xparse:

    {\oldmarginpar{\mymparsetup #2}}
    {\oldmarginpar[\mymparsetup #1]{\mymparsetup #2}}}


In the \mymparsetup command you can put all customizations you want. In this way we can keep the behavior with the optional argument to \marginpar.

The method with \let\oldcs\cs can often lead to unexpected results, when \cs has an optional argument or it's defined with \DeclareRobustCommand. However the kernel provided \marginpar is none of this kind; indeed

texdef -t latex marginpar


macro:->\ifhmode \@bsphack \@floatpenalty -\@Mii <...rest omitted...>

so we see that it's a parameterless macro and, as it often happens with LaTeX, the management of arguments is done later by other macros called by (the expansion of) \marginpar. Thus, in this case, we can safely do as shown before.

share|improve this answer
@MarcoDaniel I don't see why: if one does the right redefinition, there's no problem. :) – egreg Jun 2 '12 at 13:01
I thought that using \let has the side effect of losing the ability to have optional arguments. But your \oldmarginpar can still parse the leading []? – Andy Jun 2 '12 at 13:08
@Andy: You can use the let operation for commands with optional argument. However a more robust way is to use \LetLtxMacro provided by the package letltxmacro. – Marco Daniel Jun 2 '12 at 13:14
@Andy Actually \marginpar has no argument. I'll add something to my answer. – egreg Jun 2 '12 at 13:16

Your Answer


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.