Hot answers tagged marginpar
37
Here is my very unsatisfactory attempt at this, but perhaps someone can use this to come up with a real solution. This just requires way too much tweaking of the paramaters to control the location of the comment text.
References:
The only good part of this is from percusse's answer at Simulating hand-drawn lines.
Further Enhancements:
Replace font ...
35
Here's my solution:
Some general remarks on the implementation:
At the moment everything is bottom-aligned. Some positioning magic might be possible to get the margin notes near their footnote marks (especially when they are sparse), but probably only in a second run. It will be a lot of work to get good-looking positions when there are conflicts.
...
26
This probably isn't as robust as it could be as it's only tested on this one page but it shows a mechanism (relying on pdftex \pdfsavepos in this version) that automatically moves notes up at the end of (explicit) paragraphs, and shrinks the inter-note space as needed to avoid the notes falling off the page. In this version it never splits a note over a ...
25
Updates:
These will be removed later. Adding here now while this is being developed/tested.
2012-11-23: Added \AtEndDocument hook to add a phantom para at the end of the document. This corrects issue noticed during development where the margin par at the bottom of the last paragraph was not able to automatically shift itself up.
Here is a version ...
23
I would go about this a little differently. It seems to me that your 'Q' and 'A' could be wrapped up in a list environment, which makes me immediately think of the enumitem package.
Instead of using a command I have used an environment. Personally I find this preferable, as it may ease global changes later on- for example, you may wish to add numbers to ...
21
welcome here. Before getting to your problem, first a gentle and well-meaning reminder (actually two):
Please provide a fully worked minimal example with all submissions. Code fragments such as yours don't cut it since they leave room to keep people guessing, hopping in wrong directions, and wasting very precious time.
Please provide only one problem per ...
17
You could use the tufte-latex package for this, which provides a marginfigure environment:
\documentclass{tufte-handout}
\usepackage{graphicx}
\begin{document}
\section{Rubber Ducks}
\begin{marginfigure}[7.5ex]
\includegraphics[width=\linewidth]{rubber_duck}
\caption{A classic rubber duck}
\end{marginfigure}
A rubber duck is a toy shaped like a ...
17
The following code adds the rule only on pages with marginpars. If they appear on both sides (using a mix of \reversemarginpar and \normalmarginpar) the rules show up on both sides.
Customization possibilities are the rule itself (color, widths, etc) via \mparrule and the placement within the space given by \marginparsep via \mparrulefactor.
...
14
Disclaimer: I don't know anything about output routines. This is just meant to be a very partial first step, and the code is a mess. The idea is to collect the margin notes and the body content in two vertical boxes, check at every paragraph whether we've reached the area of the page (converted to a dimension by dividing it by 100pt, to remain within TeX's ...
14
To make sense of the way TeX works you have to remember that it is essentially a macro expansion language, your world view that has the notion "with the same \marginpar{}that is defined by default " doesn't correspond to TeX's world view at all.
With the definition you have, given
\marginpar{123}
TeX sees the first token and replaces it by its ...
14
This solution deals with the asynchronous output routine:
The pages are identified by absolute page numbers and the correct page numbers are available in the second LaTeX run using labels.
Each page get two collector boxes that collect the marginal notes for the top and the bottom. At shipout time the absolute page number is known and the collector boxes ...
13
You can automatize the generation of the marginal note:
\usepackage{etoolbox}
\makeindex
\makeatletter
\pretocmd\@wrindex
{\marginpar{\begingroup\catcode`\{=12\catcode`\}=12 \texttt{\scantokens{#1}}\endgroup}}
{}{}
\makeatother
Thus each \index command will print in the margin the argument "as is". I believe this is better than trying to replicate ...
12
TeX doesn't hyphenate the first word in a paragraph. You can write a \hspace{0pt} before it, then TeX takes this as first word.
\documentclass{scrbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{marginnote}
\usepackage[ngerman]{babel}
\usepackage{ragged2e}
\renewcommand*{\raggedleftmarginnote}{\RaggedLeft}
...
12
As tohecz mentions in his comment, you can use \marginpar for your purpose; using \captionof (from the caption or capt-of packages) you can provide the captions.
\documentclass[twoside]{article}
\usepackage[outermargin=2cm,innermargin=5cm,marginparwidth=3cm,marginparsep=20pt]{geometry}
\usepackage[demo]{graphicx}
\usepackage{marginnote}
...
11
Add \reversemarginpar after loading the geometry and todonotes packages. Note that as todonotes writes to the auxiliary file, you'll need to compile your source file at least twice to ensure that the lines it draws between the margin note and the connecting text are properly organised.
11
There a number of methods you can use. One way is to use
yet another package such as the todoor you can simply define a command as shown below, which will perhaps also be more semantically correct for notes.
\documentclass{article}
\usepackage{lipsum,xcolor}
\def\noteson{%
\gdef\note##1{\mbox{}\marginpar[$\leftarrow$ ##1]{%
\color{blue}$\leftarrow$ ...
11
Put the \marginnote inside the argument of \section* (and add \normalfont\normalsize).
\section*{One day\marginnote{\normalfont\normalsize\Date{Mon.}{28}{Nov}{2011}}}
EDIT: A better way is to change the definition of \marginfont to \normalfont\normalsize:
\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage{marginnote}
\reversemarginpar % To ...
11
What that meant was that in two-sided layouts, marginal text will change sides depending on whether the page is even or odd – and the optional argument to \marginpar will make it set different text in each case. A more full example would be:
\documentclass{book}
\begin{document}
Odd page\marginpar[$\Rightarrow$]{$\Leftarrow$}
\clearpage
Even ...
11
These are called wrapped illustrations and you can use Donald Arseneau's wrapfig package to create them.
wrapfig provides the environments wrapfigure and wrap-table for typesetting a
float at the edge of the text, and making the text wrap around it.
The wrapfigure and wrap-table environments interact properly with the \caption command to produce proper ...
10
I fear the answer is that with 2e's \marginpar this is the expected behavior. The reason for this is that LaTeX2e implements marginal notes by calling the output routine after the current line. Then in the OR it will look at the current status of the page and attach the marginal accordingly, i.e., on the left or right. It then returns the constructed ...
10
The figure number is stepped every time twice, because you're typesetting the caption twice. You can avoid this by typesetting it only once:
\newcommand{\fixedmarginpar}[2][0pt]{%
\setbox0=\vtop{\parindent=0pt \hsize=\marginparwidth#2}%
\marginpar{\vspace{\dimexpr-\ht0+#1}\box0 }%
}
In this way the box used for the measuring is not retypeset, but ...
9
One possible solution would be to use the space reserved for marginal notes to place the comments/notes and to use the background package to place the vertical rule separating the text from the notes/comments; a little example (feel free to adapt and improve my example to suit your needs):
\documentclass{article}
\usepackage{marginnote}
...
9
The difficulty with this layout, is that the dates are printed using a different grid from those of the comments, i.e., it makes a tabular environment an unsuitable way to typeset such a layout. In a way, the comments are typeset as "sideways-footnotes"!
To make it convenient for the author to enter the lines, we provide a user command as:
...
9
Using \marginpar may not be the best way to do this, but it is in fact not too difficult to set up (assuming there aren't any other \marginpars within the scope of the TOC, but then there wouldn't be any normally).
So what what needs doing? Basically when the \marginpar is encountered we have to prevent LaTeX from choosing the outside margin. Instead we ...
9
adding \mbox{} (or \leavevmode) as in:
\newcommand{\years}[1]{\mbox{}\marginnote{\footnotesize #1}}
will fix your alignment (although all the lines ending with \\ look very suspicious (and generate warnings about underfull boxes)
This works because the alignment works best if the float is tied to the paragraph, so if the insert is in the first line ...
9
The problem is intrinsic to LaTeX's marginpar implementation. One possible solution is as follows. This uses pdftex's \pdfsavepos extension, I think other newer engines have similar extensions. Also it would need to be packaged and made a bit more generic (and tested on more than this one input file). But basically the idea is that \marginpar just saves its ...
9
Regardless of the method of alignment (e.g., \marginpar, list, etc.) by the end of the day alignment happens by pushing some material towards the edge of some box. This will do proper alignment as long as the material pushed doesn't have any white space included.
With individual characters one may not expect this, but effectively there is and this is simply ...
9
EDIT Original version using a newly allocated box register is at the end. This version uses the \footins insertion register to take advantage of the primitive insert capability to pick up the correct notes for each page.
\documentclass[twoside]{article}
\newcounter{f}
\addtolength\textheight{-20\baselineskip}
\def\z{\stepcounter{f}\Roman{f}
\roman{f} ...
9
If lines don't have unusual depth, this could be a starting point:
\input eplain
\leftmargin=2in
\font\mainfont=pxr at 10pt
\font\sidenotefont=pxi at 8.5pt
\long\def\sidenote#1{%
\vadjust{\llap{\smash{\vtop{%
\parindent=0pt
\hsize=1.7in
\parfillskip=0pt
\leftskip=0pt plus1fil
\baselineskip=10pt\sidenotefont\vglue-\ht\strutbox ...
9
Here is a solution adding a bar to all pages (unless specified otherwise). The bar is typeset as a background picture, with the package eso-pic, and drawn using tikz. There is probably an easier way to achieve it, but that way is convenient to adjust the lengths, etc.
About lengths, you will see a good example of spaghetti code, showing that I don't know ...
Only top voted, non community-wiki answers of a minimum length are eligible
