This is follow up to earlier question I asked about using margin notes here
I found that when I use book style the margin note jumps from the left to the right, depending on if the page is odd or even, this is even though I made sure to added \reversemarginpar to make sure the note goes to the left side of the page.
Then I changed the book style and added oneside which fixed the issue, and now all margin note show on the left side of each page.
But the note itself now gets broken into two small lines for some reason.
Even if I use geometry to increase the left margin, it is still not working.
Examples below help show the problem. First example using default.
\documentclass[12pt]{book}
\usepackage{listings}
\usepackage{fancybox,fancyvrb,xcolor}
\usepackage{marginnote}
\definecolor{bg}{RGB}{255,255,226}
\lstdefinestyle{TEXT}{%
basicstyle=\ttfamily\normalsize,
breaklines=false,
columns=fullflexible,
keepspaces=true,
backgroundcolor=\color{bg},
rulecolor=\color{gray},
language=,
frame=single,
frameround=tttt,
aboveskip=12pt,belowskip=6pt
}
\lstnewenvironment{TEXTinline}{%
\lstset{style=TEXT}}{}
\begin{document}
\reversemarginpar
\marginnote{command}[12pt]
\begin{TEXTinline}
This is my long command
which can be very very very
long command
used to process the file
\end{TEXTinline}
\marginnote{command}[12pt]
\begin{TEXTinline}
This is my long command
which can be very very very
long command
used to process the file
\end{TEXTinline}
\marginnote{command}[12pt]
\begin{TEXTinline}
This is my long command
which can be very very very
long command
used to process the file
\end{TEXTinline}
\marginnote{command}[12pt]
\begin{TEXTinline}
This is my long command
which can be very very very
long command
used to process the file
\end{TEXTinline}
\marginnote{command}[12pt]
\begin{TEXTinline}
This is my long command
which can be very very very
long command
used to process the file
\end{TEXTinline}
\marginnote{command}[12pt]
\begin{TEXTinline}
This is my long command
which can be very very very
long command
used to process the file
\end{TEXTinline}
\marginnote{command}[12pt]
\begin{TEXTinline}
This is my long command
which can be very very very
long command
used to process the file
\end{TEXTinline}
\marginnote{command}[12pt]
\begin{TEXTinline}
This is my long command
which can be very very very
long command
used to process the file
\end{TEXTinline}
\marginnote{command}[12pt]
\begin{TEXTinline}
This is my long command
which can be very very very
long command
used to process the file
\end{TEXTinline}
\end{document}
This gives
The above shows the problem. The margin shift from left to right depending on page. Now I did the same as above, but changed \documentclass[12pt]{book} to \documentclass[12pt,oneside]{book} and everything else the same. This is the result
Looking closely at one:
What is the correct way to make all margin note show on the left side of page in book style without this breakup issue?
It looks like margin note have some fixed width. I need to find out if I can change that.
TL 2023 on Linux








\usepackage{showframe}}to document preamble and compare result when you use optiononsesideand when is not (difference is quite big). BTW, boxes are wider than\textwidth˙. Is this intentional? – Zarko Nov 20 '23 at 07:05\usepackage[marginpar=22mm]{geometry}to document preamble and than remove option12ptfrom\marginnote{....}. With this you increase width ofmarginparand not shift not to the right. by this changes you will get desired result. – Zarko Nov 20 '23 at 07:22Some text above the listing \marginnote{command} \begin{TEXTinline} This is my long command which can be very very very long command used to process the file \end{TEXTinline} etc...
– Nasser Nov 20 '23 at 07:30And this is the output:  as you see, withput[12pt]` on the margine note, it is now shifted above, I am using this per answer I linked to.