5

I created the following tcolorbox:

\documentclass{article}

\usepackage{tcolorbox}
\usepackage{lineno}


\begin{document}
\begin{tcolorbox}[middle=0mm,boxsep=0mm]
Headers

\tcblower

\setlength\linenumbersep{-.1cm} %sets the distance of the line numbers from the margin
\setcounter{linenumber}{1}
\begin{internallinenumbers}

\begin{itemize}
\item bullet 1
\item bullet 2
\item bullet 3
\begin{equation}
a = b,
\end{equation}
\noindent where $a$ and $b$ are...
\end{itemize}

\end{internallinenumbers}

\end{tcolorbox}
\end{document}

However, as you can see, the line numbers on the left margin are not showing well. I would like not to number empty lines (but only number the bullet points and equation). Is there a way to make the line number more reasonable?

Thailnd
  • 105
  • 2
  • The main cause for this is \begin{equation}...\end{equation} –  Feb 07 '16 at 12:10
  • So what if I want equations in the line numbering environment? – Thailnd Feb 07 '16 at 19:51
  • if it helps, I will be happy if equations are even not numbered at all, and ignored, but can appear in the internallinenumbers environment. – Thailnd Feb 07 '16 at 21:46
  • If you are willing to use \tcbhighmath{a=b} it works (you can change the style of \tcbhighmath with highlight math style={...} –  Feb 07 '16 at 21:48
  • it doesn't seem to work for me with \tcbhighmath -- there are still empty lines marked with numbers, and the numbers are not quite aligned with the equation. – Thailnd Feb 07 '16 at 23:36
  • Well, I can't help here -- I don't see the point in using line numbers unless you want to document code itself with LaTeX –  Feb 08 '16 at 00:12

1 Answers1

2

Based on a comment made by the OP, "if it helps, I will be happy if equations are even not numbered at all", one can resolve the issue by placing the math as inline, feigning displaymath with paragraph offsets and \hfils.

\documentclass{article}

\usepackage{tcolorbox} \usepackage{lineno}

\begin{document} \begin{tcolorbox}[middle=0mm,boxsep=0mm] Headers

\tcblower

\setlength\linenumbersep{-.1cm} %sets the distance of the line numbers from the margin \setcounter{linenumber}{1} \begin{internallinenumbers}

\begin{itemize} \item bullet 1 \item bullet 2 \item bullet 3

\hfil$%\begin{equation} a = b, $\hfil%\end{equation}

\noindent where $a$ and $b$ are... \end{itemize}

\end{internallinenumbers}

\end{tcolorbox} \end{document}

enter image description here