朋友们,我有海报框,我想在这个框中放入文字。请看图片
最小工作示例:
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{poster}
\usepackage{tikz}
\usepackage{lipsum}
\begin{document}
\begin{tcbposter}[
poster = {
columns=1,
rows=2,
spacing=3mm,
height=14cm,
width=12cm,
},
]
\posterbox[
colframe = red,
width=13cm, height= 10cm
]{ }{\includegraphics[height=4cm]{example-image-b}}
\end{tcbposter}
\end{document}
添加“ABC”和“XYZ”如附图所示 谢谢
答案1
您可以使用普通的 Ti钾环境中的 Z 命令tcbposter
。
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{poster}
\usepackage{lipsum}
\begin{document}
\begin{tcbposter}[
poster = {
columns=1,
rows=2,
spacing=3mm,
height=14cm,
width=12cm,
},
]
\posterbox[
colframe = red,
width=13cm, height= 10cm
]{name=A,column=1}{\includegraphics[height=8cm]{example-image-b}}
\node[font=\sffamily\Large,rotate=90] at (12,9.6) {XYZ};
\node[font=\sffamily\Large] at (6,5) {XYZ};
\end{tcbposter}
\end{document}
或者您可以根据图片定位这些节点。
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{poster}
\usetikzlibrary{positioning}
\usepackage{lipsum}
\begin{document}
\begin{tcbposter}[
poster = {
columns=1,
rows=2,
spacing=3mm,
height=14cm,
width=12cm,
},
]
\posterbox[
colframe = red,
width=13cm, height= 10cm
]{name=A,column=1}{\includegraphics[height=8cm]{example-image-b}}
\node[font=\sffamily\Large,rotate=90,right=-5mm of TCBPOSTER@A] {XYZ};
\node[font=\sffamily\Large,below=-10mm of TCBPOSTER@A] {XYZ};
\end{tcbposter}
\end{document}
或者您也可以只使用表格和\rotatebox
。
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{poster}
\begin{document}
\begin{tcbposter}[
poster = {
columns=1,
rows=2,
spacing=3mm,
height=14cm,
width=12cm,
},
]
\posterbox[
colframe = red,
width=13cm, height= 10cm
]{ }{\begin{tabular}{cl}
\includegraphics[height=4cm]{example-image-b} &\rotatebox{90}{XYZ} \\
XYZ &
\end{tabular}}
\end{tcbposter}
\end{document}
答案2
使用skin
库,您可以在上绘制任何您想要的东西tcolorbox
,并带有精确的坐标。
\documentclass{article}
\usepackage{geometry}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\pgfsetlayers{main}
\begin{document}
\begin{tcolorbox}[
width=13cm,height= 10cm,
skin=freelance,
interior code={%
\path (frame.south west) -- (frame.south east) node[midway,above=1ex,font=\Large\sffamily] {ABC};
\path (frame.south east) -- (frame.north east) node[midway,rotate=90,above=1ex,fill=yellow,font=\Large\sffamily,inner sep=8pt] {XYZ};
},
frame code={%
\begin{pgfonlayer}{main}
\path[draw=red,fill=gray!20,ultra thick,rounded corners] (frame.south west) rectangle (frame.north east);
\end{pgfonlayer}
},
]
\includegraphics[height=4cm]{example-image-b}
\end{tcolorbox}
\end{document}