0

I cannot find a way to specify a minimum distance between the environment and the preceding / following text. Is there a way of setting a minimum for (A) and for (B) speciffically for my example environments? They way it is now just looks too squashed to me.

enter image description here

The excerpt was produced using:

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{natbib}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{tcolorbox}

\newcounter{myexamplectr}
\newenvironment{example}[1][]

{\refstepcounter{myexamplectr} \begin{tcolorbox}[boxrule=0.1mm, arc=0mm, #1] 
        \texttt{Example \themyexamplectr}: }{\end{tcolorbox}}
\numberwithin{myexamplectr}{chapter}

\newenvironment{example*}[1]
{%\refstepcounter{myexamplectr} 
    \begin{tcolorbox}[boxrule=0mm, arc=0mm]
         \texttt{#1}:
}{\end{tcolorbox}}

\newtcolorbox{twocolBox}[1][]{
    sidebyside,
    enhanced,
    arc=0pt,
    boxsep=1mm,
    notitle,
    oversize,
    nobeforeafter,
    frame hidden,#1
}

\begin{document}

\chapter{Test}
\lipsum[1]
\begin{example}
\lipsum[1]
\end{example}
\lipsum[1]
\end{document}

1 Answer 1

0

This space can be changed with before skip=1cm,after skip=1cm, see tcolorbox docu p. 82

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{natbib}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{tcolorbox}

\newcounter{myexamplectr}
\newenvironment{example}[1][]
{\refstepcounter{myexamplectr} \begin{tcolorbox}[boxrule=0.1mm, arc=0mm, #1] 
        \texttt{Example \themyexamplectr}: }{\end{tcolorbox}}


\newenvironment{example*}[1]
{%\refstepcounter{myexamplectr} 
    \begin{tcolorbox}[boxrule=0mm, arc=0mm]
         \texttt{#1}:
}{\end{tcolorbox}}

\newtcolorbox{twocolBox}[1][]{
    sidebyside,
    enhanced,
    arc=0pt,
    boxsep=1mm,
    notitle,
    oversize,
    nobeforeafter,
    frame hidden,#1
}

\begin{document}


\lipsum[1]
\begin{example}[before skip=1cm,after skip=1cm]
\lipsum[1]
\end{example}
\lipsum[1]
\end{document}

You must log in to answer this question.

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