느낌표를 정렬하려고 했지만 수직과 수평 모두 중앙에 맞출 수 없었습니다. 제 목표는 이 이미지와 동일하게 보이도록 만드는 것입니다.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[most]{tcolorbox}
\usepackage[x11names,table]{xcolor}
%-------------------------
\definecolor{orang}{RGB}{255,155,0}
\newtcolorbox[auto counter,number within=section]{caja}[1][]{
enhanced jigsaw,colback=white,colframe=orang,coltitle=orang,
fonttitle=\bfseries\sffamily,
sharp corners,
detach title,
leftrule=22mm,
underlay unbroken and first={\node[below,text=white,font=\sffamily\bfseries,align=center]
at ([xshift=-11mm,yshift=-1mm]interior.north west) {\Huge \centering \textbf{!}};},
breakable,pad at break=1mm,
#1,
code={\ifdefempty{\tcbtitletext}{}{\tcbset{before upper={\tcbtitle\par\medskip}}}},
}
%----------------------
\begin{document}
\section{example}
\begin{caja}[title=warning]
The vertical alignment settings are only relevant for boxes which are larger than their
natural height, see Section 4.10 on page 53.
\end{caja}
\end{document}
여러분도 눈치채셨겠지만, 이것은상자에는 제목이 있습니다그리고 정렬에 영향을 미치는 것 같습니다
답변1
앵커 포인트를 조정하고 사용 anchor=east
하고 제거하고 \centering
사용하면 [xshift=-22.5pt]
원하는 출력이 생성됩니다.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[most]{tcolorbox}
%-------------------------
\definecolor{orang}{RGB}{255,155,0}
\newtcolorbox[auto counter,number within=section]{caja}[1][]{
enhanced jigsaw,colback=white,colframe=orang,coltitle=orang,
fonttitle=\bfseries\sffamily,
sharp corners,
detach title,
leftrule=22mm,
% What you need %%%%%%%%%%%%
underlay unbroken and first={\node[below,text=black,anchor=east]
at ([xshift=-22.5pt]interior.base west) {\Huge \textbf{!}};},
%%%%%%%%%%%%%%%%%%%%%%%%
breakable,pad at break=1mm,
#1,
code={\ifdefempty{\tcbtitletext}{}{\tcbset{before upper={\tcbtitle\par\medskip}}}},
}
%----------------------
\begin{document}
\section{example}
\begin{caja}[title=warning]
One-line text.
\end{caja}
\begin{caja}[title=warning]
The vertical alignment settings are only relevant for boxes which are larger than their natural height, see Section 4.10 on page 53.
\end{caja}
\begin{caja}[title=warning]
The vertical alignment settings are only relevant for boxes which are larger than their natural height, see Section 4.10 on page 53. The vertical alignment settings are only relevant for boxes which are larger than their natural height, see Section 4.10 on page 53. The vertical alignment settings are only relevant for boxes which are larger than their natural height, see Section 4.10 on page 53.
\end{caja}
\end{document}