Open lvxvvv opened 1 month ago
I wanted to understand how are this would be to tweak, so I had a quick look.
Here are some notes
For the context on this, we are using tcolorbox
package to add this border.
Currently we do https://github.com/quarto-dev/quarto-cli/blob/fa772d3d8e7681f9be0c982577fb2bd263e12b85/src/resources/filters/layout/meta.lua#L92-L94
With 0pt
for the offset. This means the the border is at the same place as the code line numbered added by Pandoc feature.
Full Tex code is
\begin{Shaded}
\begin{Highlighting}[numbers=left,,]
\BuiltInTok{print}\NormalTok{(}\StringTok{"This is a MWE."}\NormalTok{)}
\ControlFlowTok{while} \VariableTok{True}\NormalTok{:}
\BuiltInTok{print}\NormalTok{(}\StringTok{"code{-}line{-}numbers and code{-}block{-}border{-}left mwe."}\NormalTok{)}
\end{Highlighting}
\end{Shaded}
With
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{241,243,245}
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
(...)
\ifdefined\Shaded\renewenvironment{Shaded}{\begin{tcolorbox}[borderline west={3pt}{0pt}{shadecolor}, breakable, frame hidden, sharp corners, interior hidden, boxrule=0pt, enhanced]}{\end{tcolorbox}}\fi
If we use borderline west={3pt}{-9pt}{shadecolor}
for example, this would avoid the problem (but also move left the boder in all case)
Not so visible when no background
But will be different when one
compare to now
At the end this is a styling decision.
Though code-line-numbers
feature will conflict with any tcolorbox
customization that we are doing.
No border here, but background changed
We could also customize how the numbers
are shown but we don't control that line for now.
fancyvrb
package is used and numbers=left
config is written by Pandoc LaTeX writer directly
https://github.com/jgm/pandoc/blob/56854c22f49df806625c5971e82d2e1ccc6f7127/src/Text/Pandoc/Writers/LaTeX.hs#L466-L468
We don't control this, so tweaking the option for this would require some LaTeX postprocessing.
Example of customization
Not that robust, but we already do some line postprocessing to tweak some content. So maybe it is not that hard to catch \begin{Highlighting}[numbers=left,]
and replace by \begin{Highlighting}[numbers=left,numbersep=6pt,]
when tcolorbox is added and used by Quarto.
Again, styling decision. Then we can do the necessary tweak.
Hope it helps
Bug description
Description
When
code-line-numbers
is true andcode-block-border-left
is some color, the numbers overlay and overflow the border, resulting in something like this:Steps to reproduce
File:
mwe.qmd