Text Formatting ⇒ Margin notes like footnotes?
Margin notes like footnotes?
Is it possible to use margin notes like footnotes? I know I can use something like that: "some text*\marginpar{*some text}", but I need to use arabic numerals and make it more automatic, just like in \footnote.
I looked at marginnote package documentation, but couldn't find the answer.
Thanks of your help.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Margin notes like footnotes?
Code: Select all
\documentclass{book}
\usepackage{marginnote}
\newcounter{mynote}% a new counter for use in margin notes
\newcommand{\mynote}[1]{% a simple margin note
\refstepcounter{mynote}% step counter
\mbox{\textsuperscript{\themynote}}% the number (superscript) in text
\marginnote{\mbox{\textsuperscript{\themynote}}#1}% the note
}
\begin{document}
\chapter{A chapter}
Some text.\mynote{A margin note\label{one}}
Some text.
Some text.
Some text.\mynote{Another margin note}
\newpage
Some text.\mynote{A new margin note\label{two}}
Some text.
Some text.
Some text.\mynote{And one more margin note}
And here is a referencing test: the margin note labelled ``one'': note~\ref{one} on page~\pageref{one};
the margin note labelled ``two'': note~\ref{two} on page~\pageref{two}.
\end{document}
Re: Margin notes like footnotes?

PS. Do you know how to move one note down if I have two notes in the same line?
PS2. I thought I resolved this problem by using this \mynote{\\[18pt] A margin note\label{one}}, but the problem is with number (label). It stays at the line where I used \mynote whilst margin note move down. Do you know what to do?
Margin notes like footnotes?
Code: Select all
\documentclass{book}
\usepackage{marginnote}
\newcounter{mynote}% a new counter for use in margin notes
\newcommand{\mynote}[2][0]{% a simple margin note
\refstepcounter{mynote}% step counter
\mbox{\textsuperscript{\themynote}}% the number (superscript) in text
\marginnote{\mbox{\textsuperscript{\themynote}}#2}[#1\baselineskip]% the note
}
\begin{document}
\chapter{A chapter}
Some text.\mynote{A little bit longer margin note which goes over more than two lines to see how does vertical adjustment in the next margin note work.\label{one}}
Some text.\mynote[5]{Another margin note vertically adjusted}
\newpage
Some text.\mynote{A new margin note\label{two}}
Some text.
Some text.
Some text.\mynote{And one more margin note}
And here is a referencing test: the margin note labelled ``one'': note~\ref{one} on page~\pageref{one};
the margin note labelled ``two'': note~\ref{two} on page~\pageref{two}.
\end{document}
Code: Select all
\mynote[4]{margin note text}
Code: Select all
\mynote{margin note text}
Re: Margin notes like footnotes?
But..., sorry to bother you, I have another question. How to make hyphenation? Unfortunatelly I can't devide words in margin note. \- doesn't work. I was thinking maybe justification would help, but not. In addition, when I justify notes, words at the end of the line step in main text.
Maybe solution is tirvial, because I couldn't google it.
PS. So, I can use \- already. I really don't know what happened (I think I needed to push the button "Typeset" in my TeXShop a few times). But it works only when I center justify (and it doesn't work automatically, but I have to do it manually). When I want to devide word in right justify note it doesn't work.
Margin notes like footnotes?
As a side note, you might find this informative.
Margin notes like footnotes?
Code: Select all
\documentclass{book}
\usepackage{marginnote}
\renewcommand*{\marginfont}{\footnotesize}
\newcounter{mynote}% a new counter for use in margin notes
\newcommand{\mynote}[2][0]{% a simple margin note
\refstepcounter{mynote}% step counter
\mbox{\textsuperscript{\themynote}}% the number (superscript) in text
\marginnote{\mbox{\textsuperscript{\themynote}}#2}[#1\baselineskip]% the note
}
\usepackage[
marginparwidth=70pt,
papersize={176mm,235mm},
text={120mm,180.9mm},
]{geometry}
\sloppy
\begin{document}
\chapter{A chapter}
Some text.\mynote{A little bit longer margin note which goes over more than two lines to see how does vertical adjustment in the next margin note work.\label{one}}
Some text.\mynote[7]{And Here.is.a.long.word that I'd like to divide. I'd like the part of it to be on the first line.}
\end{document}
I think what you did in your example is what I need. Ragged notes would be better and sometimes I'd like to hyphenate some long words to save some vertical space on marings. I hope it's clear.
And what's the difference between floats and non-floats?
Margin notes like footnotes?
Code: Select all
\newcommand{\mybr}{-\\}
Code: Select all
\newcommand{\mynote}[2][0]{% a simple margin note
\refstepcounter{mynote}% step counter
\mbox{\textsuperscript{\themynote}}% the number (superscript) in text
\marginnote{\mbox{\textsuperscript{\themynote}}\hspace{0pt}#2}[#1\baselineskip]% the note
}
Code: Select all
\documentclass{book}
\usepackage{marginnote}
\renewcommand*{\marginfont}{\footnotesize}
\newcounter{mynote}% a new counter for use in margin notes
\newcommand{\mynote}[2][0]{% a simple margin note
\refstepcounter{mynote}% step counter
\mbox{\textsuperscript{\themynote}}% the number (superscript) in text
\marginnote{\mbox{\textsuperscript{\themynote}}\hspace{0pt}#2}[#1\baselineskip]% the note
}
\newcommand{\mybr}{-\\}% a new command for manual line break
\usepackage[
marginparwidth=70pt,
papersize={176mm,235mm},
text={120mm,180.9mm},
]{geometry}
\sloppy
\begin{document}
\chapter{A chapter}
Some text.\mynote{A little bit longer margin note which goes over more than two lines to see how does vertical adjust\mybr{}ment in the next margin note work.\label{one}}
Some text.\mynote[7]{And Here.is.a.\mybr{}long.word that I'd like to divide. I'd like the part of it to be on the first line.}
\end{document}
Margin notes like footnotes?
I'll ask on sites you told me about. If I find solution I'll put it at the end of this topic, but telling the truth \mybr{} is good for me now. I need it for a few not so long documents and I can divide words manually.
PS. I asked on {TeX} SE and got this:
Code: Select all
\usepackage{ragged2e}
\renewcommand*{\raggedleftmarginnote}{\RaggedLeft}
\renewcommand*{\raggedrightmarginnote}{\RaggedRight}
\newcommand\Marginnote[1]{\marginnote{\hspace{0pt}#1}}