1

How to increase the \parskip in the output of a tcblisting, i.e. the vertical space between the black squares in the following example?

Neither the \parskip of the surrounding text nor the spacing of the displayed code should be affected and no additional code should be shown.

(alternatively: changing the linespread or anything else to increase the vertical distance is also fine)

MWE:

\documentclass{scrartcl}

\usepackage{tikz}
\usepackage[most]{tcolorbox}

\usepackage{lipsum}

\tcbset{%
    sidebyside,
    listing options={language={[latex]TeX}},
    center lower,
    righthand width=3cm
}

\begin{document}

\lipsum[2]

\begin{tcblisting}{title={test}}
\begin{tikzpicture}
    \fill (0,0) rectangle (1,1);
\end{tikzpicture}

\begin{tikzpicture}
    \fill (0,0) rectangle (1,1);
\end{tikzpicture}
\end{tcblisting}

\lipsum[2]

\end{document}

Current output:

enter image description here

Desired output:

enter image description here

1 Answer 1

2

Use before lower={\setlength{\parskip}{10pt}} here since the output of the displayed code is displayed in the lower box, which is here sidebyside, replace the value of 10pt at will.

\documentclass{scrartcl}

\usepackage{tikz}
\usepackage[most]{tcolorbox}

\usepackage{lipsum}

\tcbset{%
    sidebyside,
    listing options={language={[latex]TeX}},
    center lower,
    righthand width=3cm,
    before lower={\setlength{\parskip}{50pt}}
}

\begin{document}

\lipsum[2]

\begin{tcblisting}{title={test}}
\begin{tikzpicture}
    \fill (0,0) rectangle (1,1);
\end{tikzpicture}

\begin{tikzpicture}
    \fill (0,0) rectangle (1,1);
\end{tikzpicture}
\end{tcblisting}

\lipsum[2]

\end{document}

enter image description here

6
  • 1
    Thanks a lot! It works great - just have to wait 7 min until I am allowed to accept your answer. Commented Aug 24, 2017 at 19:29
  • @samcarter: 7mins can be a long time. That's almost the time the light needs for traveling from the Sun to the Earth ;-)
    – user31729
    Commented Aug 24, 2017 at 19:38
  • 1
    And it is longer then it took you to answer the question :) This means you have to be somewhere within 0.5 AU from Earth - now that your location is known so precisely you should probably expect tcolorbox noobs like me waiting on your doorstep to ask questions... Commented Aug 24, 2017 at 19:48
  • @samcarter: I am a space - like vector ... translight speed is possible for me ;-)
    – user31729
    Commented Aug 24, 2017 at 20:42
  • @samcarter: By the way: Can't you use a StarGate like the 'other' Sam(antha) Carter? ;-)
    – user31729
    Commented Aug 25, 2017 at 7:58

You must log in to answer this question.

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