I need to have a line on the INNER margin in a double-sided tufte-document. There was a close question and it has this answer. That answer is perfect. Their output is:
(You see the line on the INNER part of the page)
The difference is that I use tufte-book class, but that example is for an article class. As soon as I use \marginnote{Hello} in this code snippet LaTex gives a mistake ! LaTeX Error: Not in outer par mode.
\begin{mdframed}[style=MDFStyGrayBar]
\lipsum
%\marginnote{Hello}
\lipsum
\end{mdframed}
(for the full code shamelessly stolen from the link, see below)
I wonder how to use \marginnote in mdframed environment, if possible. My search led to this question, that also doesn't have any answer.
I also have quite a number of \marginnote, marginfigure and figure* floats (with some tikz stuffing). I assume they all work the same, so I hope they will work as soon as the problem will be solved for at least one of them.
Any code modifications are welcome, as I still don't understand how that solution works anyway (I am freaking out as I see @ and code around it).
\documentclass[twoside,symmetric,notoc,justified]{tufte-book}%
\usepackage[utf8]{inputenc}
\usepackage[latin]{babel}
\usepackage[OT1]{fontenc}
\usepackage[pdftex]{graphicx}
\usepackage{lipsum}
\usepackage{float}
\usepackage{pgf,caption,calc}
\usepackage{tikz,tkz-euclide}
\usetkzobj{all}
\geometry{
%showframe,
paperwidth=145mm,
paperheight=215mm,
inner=16mm,
outer=10mm,
top=10mm,
bottom=40mm,
marginparsep=3mm,
marginparwidth=40mm,
includemp,
includehead,
}
\usepackage[framemethod=TikZ]{mdframed}
\makeatletter
\newrobustcmd*\if@mdf@pageodd@bar{%
\zref@refused{mdf@pagelabel-\the\value{mdf@zref@counter}}%
\ifodd\zref@extract{mdf@pagelabel-\the\value{mdf@zref@counter}}%
{mdf@pagevalue}%
\setlength\mdf@rightmargin@length{\mdf@outermargin@length}%
\setlength\mdf@leftmargin@length{\mdf@innermargin@length}%
\mdfsetup{hidealllines=true,leftline=true}%
\else
\setlength\mdf@rightmargin@length{\mdf@innermargin@length}%
\setlength\mdf@leftmargin@length{\mdf@outermargin@length}%
\mdfsetup{hidealllines=true,rightline=true}%
\fi%
}
\newrobustcmd*\changepageodd{\let\if@mdf@pageodd\if@mdf@pageodd@bar}
\makeatother
\mdfdefinestyle{MDFStyGrayBar}{%
linecolor=gray,
backgroundcolor=white,
%
outerlinewidth=5pt,
%
topline=false,
bottomline=false,
rightline=false,
leftline=true,
%
innertopmargin=4pt, %\baselineskip
innerbottommargin=8pt,
innerrightmargin=3pt,
innerleftmargin=3pt,
%
skipabove=\topskip,
skipbelow=\topskip,
settings={\changepageodd}
}
\usepackage{showframe,lipsum}
\begin{document}
\noindent Some normal text.
\begin{mdframed}[style=MDFStyGrayBar]
\lipsum
%\marginnote{Hello}
\lipsum
\end{mdframed}
\end{document}

\marginnoteis a float and it cannot escape the mdframed boxes. I don;t quite understand what you are mentioning about a line, please update your question to something that are clearer to understand. Also don't put your questions into the bounty. – daleif Jan 29 '18 at 13:25