SoftVarE-Group / SlideTemplate

A beamer latex template for slides and lectures at University of Ulm
Creative Commons Zero v1.0 Universal
13 stars 3 forks source link

Empty titles in colored boxes waste space and look weird #34

Closed tthuem closed 2 years ago

tthuem commented 2 years ago

grafik

On the left is the current rendering, whereas the rendering of my old template is shown on the right.

EagleoutIce commented 2 years ago

There is a simple fix to that. tcolorbox does this because even though the title appears to be empty it really isn't due to the inserted \setlength{\parskip}{0ex}\vphantom{/} at the beginning of every title. Just move this part to before title - a key which is only executed if there is a title.

For example, the definition for the macro \mydefinition

\newcommand{\mydefinition}[2]{
    \begin{tcolorbox}[title={\setlength{\parskip}{0ex}\vphantom{/}#1},colback=orange!10,colframe=orange!30,coltitle=black,fonttitle=\bfseries,left=1mm,right=1mm,top=1mm,bottom=1mm]
        #2
    \end{tcolorbox}
}

should become

\newcommand{\mydefinition}[2]{
    \begin{tcolorbox}[title={#1},before title={\setlength{\parskip}{0ex}\vphantom{/}},colback=orange!10,colframe=orange!30,coltitle=black,fonttitle=\bfseries,left=1mm,right=1mm,top=1mm,bottom=1mm]
        #2
    \end{tcolorbox}
}

I already added this fix to #31. In general, i would recommend using tcbset in order to avoid duplicating all those title=...,colback=... lines over and over again.

tthuem commented 2 years ago

Benno, could you apply that change?

Benno2000 commented 2 years ago

I applied the fix in 1a4c2a573633197781cc56df56abd8de9c644560.