0

The result of the following MWE:

\documentclass{book}

\usepackage{lipsum}

\usepackage[left, pagewise]{lineno}
\usepackage[most]{tcolorbox}

\newtcolorbox{foo}[1][]{
  blanker,
  breakable,
  left=3mm, right=3mm, top=1mm, bottom=1mm,
  borderline vertical={5pt}{0pt}{green},
  before upper=\indent,
  parbox=false,
  #1
}

\begin{document}
%\linenumbers

\chapter{Foo bar}

\lipsum[1-4]

\begin{center}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
\end{center}

\begin{foo}[oversize]
  \lipsum[1-5]
\end{foo}

\lipsum[1-4]

\end{document}

is this

enter image description here

but just adding \linenumbers screws up the result

enter image description here

What can I do?

1 Answer 1

1

Without the parbox option and with the fix from https://github.com/T-F-S/tcolorbox/issues/183 it seems to work (more or less, the boxes count as one line).

\documentclass{book}

\usepackage{lipsum}

\usepackage[left, pagewise]{lineno}
\usepackage[most]{tcolorbox}

\newtcolorbox{foo}[1][]{
  blanker,
  breakable,
  left=3mm, right=3mm, top=1mm, bottom=1mm,
  borderline vertical={5pt}{0pt}{green},
  before upper=\indent,
  %parbox=false,
  #1
}

\makeatletter
\def\@LN@depthbox{%
  \ifdim\@tempdima = -1000pt
  % \nointerlineskip is already set so we don't need set it again (and we shouldn't back up)
  \else
    \dp\@tempboxa=\@tempdima
    \nointerlineskip \kern-\@tempdima 
  \fi
  \box\@tempboxa
  } 
\makeatother
\begin{document}
\linenumbers

\chapter{Foo bar}

\lipsum[1-4]

\begin{center}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
\end{center}

\begin{foo}[oversize]
  \lipsum[1-5]
\end{foo}

\lipsum[1-4]

\end{document}

enter image description here

You must log in to answer this question.

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