0

enter image description here

The desired output is as in the second one, but I still want the flexbility of tcolorbox when placing margin notes

My MWE

\documentclass[11pt, a4paper,draft]{book}

\usepackage{fancyhdr}
\pagestyle{empty}

\usepackage[a4paper]{geometry}
% BEGIN_FOLD
    
    % Horizontal
    \geometry{textwidth=5cm, marginparsep=3.5mm, marginparwidth=5cm, bindingoffset=0mm, includemp=true}
    
    \geometry{showframe=false, twoside=false}
    
% END_FOLD

\usepackage[x11names]{xcolor}

\usepackage{marginnote}

% =========== Framed boxes packages ===========    
\usepackage{tcolorbox}
\tcbuselibrary{skins,breakable}
% BEGIN_FOLD    

\NewDocumentCommand{\sampleText}{}{{\color{gray} Lorem ipsum dolor sit amet, consectetuer adip- iscing elit. Etiam lobortis facilisis sem. Nullam nec mi et neque pharetra sollicitudin. Praesent im- perdiet mi nec ante.}}

\tcbset{MarginNote/.style=%
    {
        size=minimal,
        colframe=white, colback=Ivory1,
        opacityframe=0, opacityback=0.75,
        box align=base,
        nobeforeafter,
        width=\linewidth,
    }
}%

% END_FOLD

\begin{document}

\smash{\rlap{\rule{\dimexpr \linewidth + \marginparsep + \marginparwidth \relax}{0.1pt}}}%
Text%
\marginnote{%
\tcbox[MarginNote]{\parbox{\linewidth}{The quick brown fox}}%
}
Text

\medskip

\smash{\rlap{\rule{\dimexpr \linewidth + \marginparsep + \marginparwidth \relax}{0.1pt}}}%
Text%
\marginnote{%
    \tcbox[MarginNote]{\parbox{\linewidth}{The quick brown fox jumps over the lazy dog}}%
}
Text

\vspace*{2em}

\smash{\rlap{\rule{\dimexpr \linewidth + \marginparsep + \marginparwidth \relax}{0.1pt}}}%
Text%
\marginnote{%
    The quick brown fox%
}
Text

\medskip

\smash{\rlap{\rule{\dimexpr \linewidth + \marginparsep + \marginparwidth \relax}{0.1pt}}}%
Text%
\marginnote{%
    The quick brown fox jumps over the lazy dog%
}
Text

\end{document}

1 Answer 1

1

Use \parbox[t] otherwise you get vertical centering which naturally moves things off the baseline.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .