Was und wie stelle ich ein, dass mein Titel in tcolorbox nach oben geht?

Was und wie stelle ich ein, dass mein Titel in tcolorbox nach oben geht?

Dies ist die Quelle auf Seite 182 des tcolorbox-Handbuchs. Nett, Sie kennenzulernen. Latex-Neuling. Es ist mir eine Ehre, Ihnen die erste Frage zu stellen.

Ich weiß nicht, wie ich meinen Titel so ändern kann, dass er nach oben geht:

%------------------------
\newtcolorbox{mybox}[2][]{skin=enhancedlast jigsaw,interior hidden,
boxsep=0pt,top=0pt,colframe=red,coltitle=red!50!black,
fonttitle=\bfseries\sffamily,
attach boxed title to bottom center,
boxed title style={empty,boxrule=0.5mm},
varwidth boxed title=0.5\linewidth,
underlay boxed title={
\draw[white,line width=0.5mm]
([xshift=0.3mm-\tcboxedtitleheight*2,yshift=0.3mm]title.north west)
--([xshift=-0.3mm+\tcboxedtitleheight*2,yshift=0.3mm]title.north east);
\path[draw=red,top color=white,bottom color=red!50!white,line width=0.5mm]
([xshift=0.25mm-\tcboxedtitleheight*2,yshift=0.25mm]title.north west)
cos +(\tcboxedtitleheight,-\tcboxedtitleheight/2)
sin +(\tcboxedtitleheight,-\tcboxedtitleheight/2)
-- ([xshift=0.25mm,yshift=0.25mm]title.south west)
-- ([yshift=0.25mm]title.south east)
cos +(\tcboxedtitleheight,\tcboxedtitleheight/2)
sin +(\tcboxedtitleheight,\tcboxedtitleheight/2); },
title={#2},#1}
\begin{mybox}{My title}
\lipsum[2]
\end{mybox}
%------------------------

Antwort1

Geben Sie beim nächsten Mal ein zusammengestelltes Dokument\documentclass --> \end{document}

Es war notwendig, zu ändern

  • enhancedlast jigsawZuenhancedlast jigsaw
  • northZusouth
  • yshiftumgedreht

Der Code

\documentclass[border=3mm]{standalone}
\usepackage[most]{tcolorbox}
\usepackage{varwidth}
\usepackage{lipsum}
%------------------------
\newtcolorbox{mybox}[2][]{skin=enhancedlast jigsaw,interior hidden,
boxsep=0pt,top=0pt,colframe=red,coltitle=red!50!black,
fonttitle=\bfseries\sffamily,
attach boxed title to bottom center,
boxed title style={empty,boxrule=0.5mm},
varwidth boxed title=0.5\linewidth,
underlay boxed title={
\draw[white,line width=0.5mm]
([xshift=0.3mm-\tcboxedtitleheight*2,yshift=0.3mm]title.north west)
--([xshift=-0.3mm+\tcboxedtitleheight*2,yshift=0.3mm]title.north east);
\path[draw=red,top color=white,bottom color=red!50!white,line width=0.5mm]
([xshift=0.25mm-\tcboxedtitleheight*2,yshift=0.25mm]title.north west)
cos +(\tcboxedtitleheight,-\tcboxedtitleheight/2)
sin +(\tcboxedtitleheight,-\tcboxedtitleheight/2)
-- ([xshift=0.25mm,yshift=0.25mm]title.south west)
-- ([yshift=0.25mm]title.south east)
cos +(\tcboxedtitleheight,\tcboxedtitleheight/2)
sin +(\tcboxedtitleheight,\tcboxedtitleheight/2); },
title={#2},#1}

\newtcolorbox{mybox2}[2][]{
  skin=enhancedfirst jigsaw,%<--  last -> first
  interior hidden,
  bottom=0pt,
  colframe=red,
  coltitle=red!50!black,
fonttitle=\bfseries\sffamily,
attach boxed title to top center,%<--- bottom -> first
boxed title style={empty,boxrule=0.5mm},
varwidth boxed title=0.5\linewidth,
%%%%%%%%%  south <--> north
%%%%%%%%%  yshift + --> yshift -
underlay boxed title={
  \draw[white,line width=0.5mm]
  ([xshift=0.3mm-\tcboxedtitleheight*2,yshift=-0.3mm]title.south west)
  --([xshift=-0.3mm+\tcboxedtitleheight*2,yshift=-0.3mm]title.south east);
  \path[draw=red,top color=white,bottom color=red!50!white,line width=0.5mm]
  ([xshift=0.25mm-\tcboxedtitleheight*2,yshift=-0.25mm]title.south west)
  cos +(\tcboxedtitleheight,\tcboxedtitleheight/2)
  sin +(\tcboxedtitleheight,\tcboxedtitleheight/2)
  -- ([xshift=0.25mm,yshift=-0.25mm]title.north west)
  -- ([yshift=-0.25mm]title.north east)
  cos +(\tcboxedtitleheight,-\tcboxedtitleheight/2)
  sin +(\tcboxedtitleheight,-\tcboxedtitleheight/2); },
title={#2},#1}
\begin{document}
\begin{mybox}{My title}
  \lipsum[2]
\end{mybox}

\begin{mybox2}{My title}
  \lipsum[2]
\end{mybox2}
%------------------------
\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen