1

Using tcblisting I found that \parskip seems to be ignored.

\documentclass{article}
\parskip\baselineskip

\usepackage{tcolorbox}

\tcbuselibrary{listings}

\begin{document}
    
    \begin{tcblisting}{%listing engine=minted, %listing only,
            verbatim ignore indention at end}
        \begin{tabular}{rl}
            1 & First point \\
            2 & Another point \\
        \end{tabular}
        
        Look at the previous 2 points.
    \end{tcblisting}
    
    \begin{tabular}{rl}
        1 & First point \\
        2 & Another point \\
    \end{tabular}
        
    Look at the previous 2 points.
    
\end{document}

enter image description here

Is there a way to also add parskip to tcblisting?

3

1 Answer 1

1

You can change the parskip for the tcolorbox like this:

\documentclass{article}
\parskip\baselineskip

\usepackage{tcolorbox}

\tcbuselibrary{listings}

\begin{document}
    
    \begin{tcblisting}{%listing engine=minted, %listing only,
            verbatim ignore indention at end,before lower={\parskip\baselineskip}}
\begin{tabular}{rl}
    1 & First point \\
    2 & Another point \\
\end{tabular}

Look at the previous 2 points.
    \end{tcblisting}
    
    \begin{tabular}{rl}
        1 & First point \\
        2 & Another point \\
    \end{tabular}
        
    Look at the previous 2 points.
    
\end{document}

enter image description here

8
  • @Thanks for the answer. I cannot replicate the image you posted with the code you posted though: Why is your code not indeted but mine it? May 15 at 10:49
  • 1
    @mrCarnivore I removed the indention in your code. In your question, your code is indented by 8 spaces. But as already commented, you should not mix different topics in a single question. This does not work well on a site which uses duplicates etc. to link similar questions. May 15 at 10:51
  • But it also adds a parskip at the beginning of the lower part... May 15 at 11:25
  • 1
    @mrCarnivore Yes, the lower part is a new paragraph. If you don't want this, add a negative \vspace or similar May 15 at 11:26
  • 1
    @mrCarnivore You can add it in before lower={...}. Your question could still benefit from an edit so it focuses only on one problem ... May 15 at 11:37

You must log in to answer this question.

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