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 trying out a new definition style for my thesis. If a new term is introduced, I repeat it in the margin (and emphasize it inline). A simplified demonstration:

\newcommand*{\idef}[1]{%
  \marginnote{\fbox{#1}}%
  \emph{#1}%
}

Sometimes, two new terms will be introduced on the same line. Right now the second margin-note will just overlap the first. I'd like it placed next to the first. Or below the first, in the absence of horizontal space.

How could I accomplish this?

Edit: All solutions proposed so far (including my own) can only place excess notes below others. Ideally, when there's space, I'd like a same-line-origin note to be placed next to the previous (to its right).

This is tricky, depending on when \marginpars are typeset, exactly. I believe the only way would be to postpone typesetting the note until the end of the line has been reached, and 'prepare it' until then. But I'm a bit out of my element there.

share|improve this question
3  
Use \marginpar. –  egreg Dec 27 '12 at 21:05
    
\marginpar often gives me bad placement (right margin on even page for example). I've had more predictable and robust results with \marginnote. –  mhelvens Dec 27 '12 at 21:08
1  
Use also the mparhack package. With \marginnote you don't have the feature you'd like. Are those margin notes to appear also in the final version? I hope not. –  egreg Dec 27 '12 at 21:46
2  
you could try the (not really finished) mpnote package tex.stackexchange.com/questions/78193/… –  David Carlisle Dec 28 '12 at 0:51
    
@DavidCarlisle That looks interesting, but I don't think I need it. My particular margin-notes will rarely use more than one line. –  mhelvens Dec 28 '12 at 21:13

2 Answers 2

up vote 4 down vote accepted

I've decided to go with \marginpar. I had issues with that command but I've been able to fix them.

Initially I could not use \marginpar because it had bad placement and alignment, so I found marginnote and stuck with it for a while.

Placement: I have a specific case where, at the top of a verso page, a note is put in the right (not left) margin. The mparhack package didn't work. The marginfix package put the note on the previous page, rather than the correct margin. Then I discovered the memoir command \strictpagecheck, which fixed the issue for me.

Alignment: \marginpar would align away from the main text, rather than towards the main text. This answer fixed that issue for me.

(The todonotes package knut suggested is basically \marginpar but with a lot of extra formatting. Formatting I don't need, as it happens.)

share|improve this answer
    
As always, I'd rather not accept my own answer if someone else can top it. Particularly, if you can make the margin notes stack horizontally (given sufficient space, otherwise let them wrap to a new line), the green tick is yours! –  mhelvens Dec 30 '12 at 13:55

You may try the todonotes-package for your purposes.

Example:

\documentclass[english]{scrartcl}
\usepackage{babel,blindtext}
\usepackage{todonotes}

\newcommand{\idef}[2][]{%
  \todo[color=none, linecolor=none,#1]{#2}%
  \emph{#2}%
}


\begin{document}
\blindtext
\idef{term} and \idef{another term}
\blindtext

\listoftodos[Terms]
\end{document}

The example defines a todo without a line from the location in the text to the marginnote. Please refer the documentation for other possibilities to format the todonote.

My example contains also a list of all terms.

The result (the red block is not part of the pdf, it is an insertion to show the locations of the inline-idef):

Example output

share|improve this answer
    
Hm. I recognize the placement of todonotes. It's like \marginpar, which, for some reason, often gets placement incorrect for me (wrong margin, wrong spacing). \marginnote always works, though (apart from the issue I mentioned). <>---<> It also has some rather extreme formatting that I'd have to get rid of and it uses too much space between notes. I'll experiment with this, but it feels like there should be an easier way. –  mhelvens Dec 27 '12 at 20:53
    
Perhaps it look now a bit better - I modified the example a bit. And yes, there is some space between the notes. –  knut Dec 27 '12 at 20:59
    
Gotta say, kudos for the effort you put into your example. :-) I'll try and play with the todonotes options, see if it can work for me. –  mhelvens Dec 27 '12 at 21:02
    
You made no MWE, but wrote about 'thesis'. Please refer tex.stackexchange.com/questions/33423/… if you use classicthesis. –  knut Dec 27 '12 at 21:05
    
I'm using memoir. I just discovered it has some margin-features itself. Checking them out now. –  mhelvens Dec 27 '12 at 21:10

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.