# listings breaklines and escapeinside vs marginnote [closed]

Consider the MWE below. When I edit manuscripts I often tend to use the fixme package and its marginnote layout for notes to myself or the editor. In the latest project, I had to comment inside a listings construction. I my MWE I've boiled it down to having breaklines active and adding a long comment inside an escape to LaTeX in the listing.

Here are some observations

1. why does the size of breakindent affect the marginnote?
2. what exactly is the width of the marginnote, it does not seem to break corerctly
3. if one replace \marginnote by \marginpar then everything work correctly. So which document resetting is \marginnote missing?
4. one also get the correct breaks if one use \marginnote{\parbox...}

BTW: I use the marginote layout over the marginpar one as the marginnote can be used everywhere!

MWE:

\documentclass[a4paper]{article}
\usepackage{marginnote}
\usepackage{listings}
\setlength\marginparwidth{3cm}
\lstdefinestyle{mystyle}{
breaklines=true,
escapeinside=YY,
%  breakindent=0pt,
}
\lstnewenvironment{TEST}[1][]{
\lstset{style=mystyle,#1}
}{}
\newcommand\test[1]{\marginnote{#1}}

\begin{document}

% all is suppose to be written on one long line
\begin{TEST}
test Y\test{this is a long note that just keeps on going forever and ever and ever and ever and ever and ever}Y test test test test test test test test test test test
\end{TEST}

\end{document}


Sniplet of the output I get:

## closed as off-topic by Schweinebacke, Stefan Pinnow, Sebastiano, TeXnician, dexteritasJul 23 '18 at 10:47

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• I'm voting to close this question as off-topic because the problem is outdated. If can be fixed by updating at least package marginnote. – Schweinebacke Jul 23 '18 at 7:17

\newcommand\test[1]{{\everypar{}\marginnote{#1}}}

• @daleif probably should do \@parboxrestore` which resets a host of things, including this. – David Carlisle Jun 27 '18 at 14:56