4

Does \marginnote mess a little when it comes to tcolorbox? I have adapted some code from this other question and the first box renders fine, but the following ones are a disaster. I've struggled a little to reproduce the issue as in my tex file it doesn't happen inmediately after the first marginnote. There are also other effects I don't take into account in the following MWE, for example, sometimes the marginnote is discarded completely (but if it has a counter, it runs over).

\documentclass[twoside,a4paper]{tufte-handout}
\usepackage{etoolbox}%
\usepackage{blindtext}%
\usepackage[tikz]{bclogo}%
\usepackage[skins,breakable]{tcolorbox}%
\usepackage{marginfix}  
% Code adapted from https://tex.stackexchange.com/questions/198255/bclogo-page-breaks
\newtcolorbox[auto counter]{myexample}{
   breakable,
    skin= enhanced,
    boxrule=0pt,boxsep=0pt,arc=2mm,toptitle=3mm,top=3mm,left=7mm,right=1mm,pad at break=2mm,
    colframe=red!20!white,
    interior hidden,
    coltitle=black,fonttitle=\bfseries,title={Example \thetcbcounter},
    overlay unbroken and first={\node[inner sep=0pt] (logo) at ([xshift=4mm,yshift=-5mm]frame.north west) {\bcinfo};
    \draw[red,line width=3.5pt] (logo) -- ([xshift=4mm,yshift=1.5mm]frame.south west);  },
  overlay middle and last={\draw[red,line width=3.5pt] ([xshift=4mm,yshift=-1.5mm]frame.north west) -- ([xshift=4mm,yshift=1.5mm]frame.south west); },
     }

\begin{document}

\section{First}

\marginnote{
\begin{myexample}
Bla bla Bla bla Bla bla Bla bla Bla bla $5x^2 + 2x + 3 $ Bla bla la $x$ Bla bla Bla bla Bla bla
\[5\cdot 10^2 + 2\cdot 10 + 3 = 523 \] 
Bla bla Bla bla Bla bla Bla bla Bla bla
\end{myexample}}

\blindtext[4]

\marginnote{
\begin{myexample}
\blindtext
\end{myexample}}

\blindtext[4]

\marginnote{
\begin{myexample}
Bla bla Bla bla Bla bla Bla bla Bla bla $5x^2 + 2x + 3 $ Bla bla la $x$ Bla bla Bla bla Bla bla
\[5\cdot 10^2 + 2\cdot 10 + 3 = 523 \] 
Bla bla Bla bla Bla bla Bla bla Bla bla
\end{myexample}}

\blindtext[4]

\blindtext[4]
\marginnote{
\begin{myexample}
\blindtext
\end{myexample}}

\blindtext[4]
\blindtext[4]

\end{document}

OK

NOK1

NOK2

  • 5
    Imho a breakable tcolorbox inside a marginnote is madness. – Ulrike Fischer Nov 26 '14 at 18:34
  • Arff, well, one more day learning something. Thanks. – Pablo B. Nov 26 '14 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.