tcolorbox:tcbposter 更改注释样式

tcolorbox:tcbposter 更改注释样式

有没有办法改变 showframe-annotations 的样式?
我想旋转col1, col2, ...90° 并设置字体\tiny
这对于大量列(比如 30-50 列)很有用。

在此处输入图片描述

\documentclass{article}
\usepackage[margin=2cm, 
showframe=true]{geometry}
\usepackage[most]{tcolorbox}

\begin{document}
\noindent\begin{tcbposter}[
poster = {showframe=true, 
height=3cm, spacing=2mm, rows=2, columns=5,
height=6cm,  
},
boxes = {beamer, colframe=blue!50!black, colback=blue!50, colupper=yellow!50, 
},
]
\posterbox{name=A, row=2,  column=3,}{First box}
\end{tcbposter}
\end{document}

答案1

您可以尝试找到相应的片段代码并适应您的需求。

我在 里找到了tcb@poster@env。只需要改一行,但都是一起的。我不知道如何提取它。

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lmodern}
\usepackage[margin=2cm, showframe=true]{geometry}

\makeatletter
\renewenvironment{tcb@poster@env}{%
  \let\posterbox\tcb@poster@box%
  \let\posterboxenv\tcb@poster@boxenv%
  \let\endposterboxenv\endtcb@poster@boxenv%
  \ifundef\tcb@poster@height{%
    \ifnum\c@tcblayer=0\relax%
      \def\tcb@poster@height{\textheight}%
    \else%
      \ifdim\dimexpr\tcbtextheight>0pt\relax%
        \def\tcb@poster@height{\tcbtextheight}%
      \else%
        \def\tcb@poster@height{0.75\textheight}%
      \fi%
    \fi}{}%
  \tcbset{poster/.cd,poster@poster}%
  \tcbdimto\tcbposterwidth{\tcb@poster@width}%
  \tcbdimto\tcbposterheight{\tcb@poster@height}%
  \tcbdimto\tcbpostercolspacing{\tcb@poster@colspacing}%
  \tcbdimto\tcbposterrowspacing{\tcb@poster@rowspacing}%
  \edef\tcbpostercolumns{\the\numexpr\tcb@poster@columns\relax}%
  \edef\tcbposterrows{\the\numexpr\tcb@poster@rows\relax}%
  \tcbdimto\tcbpostercolwidth{(\tcbposterwidth+\tcbpostercolspacing)/\tcbpostercolumns-\tcbpostercolspacing}%
  \tcbdimto\tcbposterrowheight{(\tcbposterheight+\tcbposterrowspacing)/\tcbposterrows-\tcbposterrowspacing}%
  \begin{tikzpicture}%
  \path[use as bounding box] (0,0) rectangle (\tcbposterwidth,\tcbposterheight);
  \node[name=\tcb@poster@prefix poster,at={(0,0)},line width=0mm,inner sep=0mm,outer sep=0mm,draw=none,fill=none,rectangle,
    above right,minimum width=\tcbposterwidth,minimum height=\tcbposterheight]{};
  \coordinate (\tcb@poster@prefix top) at (0,\tcbposterheight+\tcbposterrowspacing);
  \coordinate (\tcb@poster@prefix bottom) at (0,-\tcbposterrowspacing);
  \coordinate (\tcb@poster@prefix middle) at (0,\the\dimexpr0.5\dimexpr\tcbposterheight\relax);
  \begin{scope}[every node/.style={inner sep=0pt,outer sep=0,above right,minimum height=\tcbposterheight,minimum width=\tcbpostercolwidth}]%
    \node (\tcb@poster@prefix col1) at (0,0) {};
    \@tempcnta 1%
    \@tempcntb\numexpr\tcbpostercolumns\relax%
    \@tempdima\dimexpr\tcbpostercolwidth+\tcbpostercolspacing\relax%
    \@whilenum \@tempcnta<\@tempcntb \do{%
      \edef\tcb@temp{\tcb@poster@prefix col\@arabic\@tempcnta}%
      \advance\@tempcnta 1\relax%
      \node[xshift=\tcbpostercolspacing] (\tcb@poster@prefix col\@arabic\@tempcnta) at (\[email protected] east) {};
    }%
  \end{scope}%
  \begin{scope}[every node/.style={inner sep=0pt,outer sep=0,below right,minimum height=\tcbposterrowheight,minimum width=\tcbposterwidth}]%
    \node (\tcb@poster@prefix row1) at (0,\tcbposterheight) {};
    \@tempcnta 1%
    \@tempcntb\numexpr\tcbposterrows\relax%
    \@tempdima\dimexpr\tcbposterrowheight+\tcbposterrowspacing\relax%
    \@whilenum \@tempcnta<\@tempcntb \do{%
      \edef\tcb@temp{\tcb@poster@prefix row\@arabic\@tempcnta}%
      \advance\@tempcnta 1\relax%
      \node[yshift=-\tcbposterrowspacing] (\tcb@poster@prefix row\@arabic\@tempcnta) at (\[email protected] west) {};
    }%
  \end{scope}%
  \iftcb@poster@showframe%
    \@tempcnta 0%
    \@tempcntb\numexpr\tcbpostercolumns\relax%
    \@whilenum \@tempcnta<\@tempcntb \do{%
      \advance\@tempcnta 1\relax%
      \edef\tcb@temp{\tcb@poster@prefix col\@arabic\@tempcnta}%
      \draw[red] (\[email protected] west) node[above right, rotate=90, anchor=north west]{col\@arabic\@tempcnta} rectangle (\[email protected] east);
    }%
    \@tempcnta 0%
    \@tempcntb\numexpr\tcbposterrows\relax%
    \@whilenum \@tempcnta<\@tempcntb \do{%
      \advance\@tempcnta 1\relax%
      \edef\tcb@temp{\tcb@poster@prefix row\@arabic\@tempcnta}%
      \draw[red] (\[email protected] west) node[below left]{row\@arabic\@tempcnta} rectangle (\[email protected] east);
    }%
    \gdef\tcb@poster@framelist{}%
  \fi%
}{%
  \iftcb@poster@showframe%
    \renewcommand*{\do}[1]{%
      \node[red,fill=white,opacity=0.7,font=\Large] at (\tcb@poster@prefix##1) {##1};}%
    \dolistloop{\tcb@poster@framelist}%
    \gdef\tcb@poster@framelist{}%
  \fi%
\end{tikzpicture}}
\makeatother

\begin{document}
\noindent\begin{tcbposter}[
poster = {showframe=true, 
height=3cm, spacing=2mm, rows=2, columns=20,
height=6cm,  
},
boxes = {beamer, colframe=blue!50!black, colback=blue!50, colupper=yellow!50, 
},
]
\posterbox{name=A, row=2,  column=3,}{First box}
\end{tcbposter}
\end{document}

在此处输入图片描述

相关内容