Tag Info

Hot answers tagged

48

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 ...


41

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. ...


31

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 ...


30

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 ...


24

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 ...


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 ...


19

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. ...


18

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 ...


17

Thank you for the answers! I add my own since I found it on the todonotes package author's blog page: http://midtiby.blogspot.com/2008/05/updated-todonotes-package.html?showComment=1215360900000#c7770492295748791763 Your problem with the "Marinpar in page x moved" is probably caused by placing several todonotes on one page. If two todonotes (they are in ...


17

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.


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 ...


16

As mentioned already in the comments you can use escapeinside option of lstlisting (listings package) to execute own code inside a code listing. There are also executebegin and executeend to insert code automatically before and after such markers. My idea: * Use minipages to restrain the listing to less than the text width and move it to the right using ...


15

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} ...


15

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 ...


14

The package morefloats doubles the number of floats that can be handled.


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

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} ...


14

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 ...


13

\hspace{0pt}\marginpar{...} at the front of the paragraph should do the job.


13

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 ...


13

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 ...


12

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$ ...


12

\documentclass[twoside]{article} \usepackage{geometry} \geometry{a4paper,left=3cm,right=8cm,marginparwidth=6cm} \usepackage{xcolor} \usepackage{lipsum} \usepackage{amsmath,amsthm} \newtheorem{theorem}{Theorem} \usepackage{mdframed} \usepackage{marginnote} \newcommand\mnote[2][0pt]{% \marginnote{% ...


12

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 ...


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 ...


11

You could use the marginnote package and use its \marginnote command. \marginnote is a non-floating version of \marginpar and can also be used inside the align environment: \documentclass{article} \usepackage{amsmath} \usepackage{marginnote} \begin{document} \begin{align} E^2 \marginnote{Not correct} \end{align} \end{document}


11

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 ...


10

Here's one possible solution patching (with the help of the etoolbox package) the LaTeX kernel command \@addmarginpar: \documentclass[twoside]{book} \usepackage[centering,marginparwidth=2.5cm]{geometry} \usepackage{etoolbox} \usepackage{lipsum} \makeatletter \patchcmd{\@addmarginpar}{\ifodd\c@page}{\ifodd\c@page\@tempcnta\m@ne}{}{} \makeatother ...


10

One option using \tikzmark (since some calculations are performed for the bar placement, the code needs three runs to stabilize). The bar admits (multiple) page breaks: \documentclass{article} \usepackage[a5paper,rmargin=4cm]{geometry} \usepackage{atbegshi} \usepackage{refcount} \usepackage{setspace} \usepackage{tikzpagenodes} \usetikzlibrary{calc} ...


10

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} ...



Only top voted, non community-wiki answers of a minimum length are eligible