5

This MWE example, compiled with lualatex

\documentclass[11pt]{book}
\usepackage{blindtext}
\usepackage{marginnote}
\usepackage{showframe}
\usepackage[letterpaper,outer=1.8in,bindingoffset=6mm,top=1in,bottom=.85in]{geometry}
\begin{document}
\marginnote{\blindtext}
\Blindtext
\end{document}

gives

Mathematica graphics

I tried add this line before the command \renewcommand*{\raggedrightmarginnote}{\centering} and get this (still not fully justified )

Mathematica graphics

I tried the commands shown on page 2 of the documentation, but now I get an error

Mathematica graphics

MWE

\documentclass[11pt]{book}
\usepackage{blindtext}
\usepackage{marginnote}
\usepackage{showframe}

\begingroup
\makeatletter
\g@addto@macro\framed{%
\let\marginnoteleftadjust\FrameSep
\let\marginnoterightadjust\FrameSep
}
\endgroup

\usepackage[letterpaper,outer=1.8in,bindingoffset=6mm,top=1in,bottom=.85in]{geometry}
\begin{document}

\marginnote{\blindtext}
\Blindtext
\end{document}

error is

(/usr/local/texlive/2015/texmf-dist/tex/latex/latexconfig/color.cfg)
(/usr/local/texlive/2015/texmf-dist/tex/latex/pdftex-def/pdftex.def))))
! Undefined control sequence.
<argument> \framed 

l.11 }

? 

I would have expected the side margin note to be fully justified by default as in the main text. How to fix this?

TL 2015, lualatex compiler.

https://www.ctan.org/pkg/marginnote

Update

Thanks for comments below. I tried one of the suggestions, but for somereason I get an error. May be I am doing something wrong. I am newbie in advanced Latex programming.

\documentclass[11pt]{book}
\usepackage{blindtext}
\usepackage{marginnote}
\usepackage{showframe}
\newcommand\mymarginnote[1]{\marginnote{\justify #1}}

\usepackage[letterpaper,outer=1.8in,bindingoffset=6mm,top=1in,bottom=.85in]{geometry}
\begin{document}
\mymarginnote{\blindtext}
\Blindtext
\end{document}

Compiled with lualatex

(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/ifvtex.sty)
(/usr/local/texlive/2015/texmf-dist/tex/generic/ifxetex/ifxetex.sty))
(./foo.aux) (/usr/local/texlive/2015/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
)
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
! Undefined control sequence.
<argument> ...te \strut \hspace {\z@ }\ignorespaces \justify 
                                                  \blindtext \endgraf \vss }...
l.10 \Blindtext

? 
Nasser
  • 20,220
  • Usually, I define a \newcommand\mymarginnote[1]{\marginnote{\justify #1}} for this. – Stefan Braun Jun 04 '16 at 19:01
  • 3
    the width of the margin note is very small, and justifying it could make it much harder to read. i would definitely not expect it to be justified; ragged right is a reasonable decision. if you must set it justified, you can try inserting \rightskip=0pt\relax in the note. – barbara beeton Jun 04 '16 at 19:02
  • Referring to the Undefined control sequence.: I believe that you require the framed package ... – Stefan Braun Jun 04 '16 at 19:08

1 Answers1

8

I do not recommend to justify text in such a small note.

To justify the margin note you can use

\renewcommand\raggedrightmarginnote{}
\renewcommand\raggedleftmarginnote{}

But then you will get many overfull or underfull boxes:

enter image description here

Or you could use

\renewcommand\raggedrightmarginnote{\sloppy}
\renewcommand\raggedleftmarginnote{\sloppy}

Then you will get big gaps in your notes:

enter image description here

Code:

\documentclass[11pt]{book}
\usepackage{blindtext}
\usepackage{marginnote}
\renewcommand\raggedrightmarginnote{\sloppy}
\renewcommand\raggedleftmarginnote{\sloppy}
\usepackage{showframe}
\usepackage[letterpaper,outer=1.8in,bindingoffset=6mm,top=1in,bottom=.85in]{geometry}
\begin{document}
\marginnote{\blindtext}
\Blindtext\marginnote{\blindtext}
\end{document}

Off topic: An example with Comic Sans for Johannes_B ;-)

enter image description here

esdd
  • 85,675
  • 2
    The result might be less awful if typeset with Comic Sans? – Johannes_B Jun 04 '16 at 19:52
  • @Johannes_B There is now an example for you ;-) Da schauen die Lücken doch gleich weniger schlimm aus, oder? – esdd Jun 04 '16 at 20:08
  • Oh indeed, nice :-) – Johannes_B Jun 04 '16 at 20:11
  • 1
    With microtype and slightly wider margin notes with a slightly smaller font size the result actually looks quite good: a solid rectangle of text on the left (main text) and solid rectangles of texts on the right (margin notes). – Júda Ronén May 28 '21 at 14:05