tcolorbox, tcbraster의 내용과 절대 위치를 수직으로 중앙에 배치합니다.

tcolorbox, tcbraster의 내용과 절대 위치를 수직으로 중앙에 배치합니다.

을(를) 만들고 싶지만 tcolorbox지금은 여러분의 도움이 필요합니다.

  1. 콘텐츠를 수직으로 중앙에 배치

  2. 절대 위치 tcolorbox: 위치를 변경할 때엑스또는와이

내 최소 코드:

\documentclass{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage[skins,listings,breakable,listingsutf8,theorems,hooks,fitting]{tcolorbox}%
\tcbuselibrary{most}
\usepackage{makecell,tabularx}
\setcellgapes{12pt}
\usepackage{array}
\usepackage{colortbl}
\tcbuselibrary{skins}

\usepackage{tikz}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

\tcbset{tableA/.style={
enhanced,
fonttitle=\bfseries,
fontupper=\normalsize\sffamily,
colback=blue!10!white,
colframe=green!50!black,
colbacktitle=red!40!white,
coltitle=black,center title}}

\begin{document}
\begin{tcbraster}[colback=red!5!white,colframe=red!75!black,
fonttitle=\bfseries,fontlower=\itshape] %
{
\makegapedcells
\begin{tcolorbox}[tableA,tabularx*={\renewcommand{\arraystretch}{1.5}}{Y|Y|},title={This is a table},boxrule=0.8pt]
A & B          \\\hline
A   & \includegraphics[width = 2cm]{"example-image-a"}   \\\hline
A & AAA  \\\hline
B  & BBB  \\\hline
A   & \includegraphics[width = 2cm]{"example-image-b"} 
\end{tcolorbox}
}
\end{tcbraster}


\end{document}

여기에 이미지 설명을 입력하세요

정말 고마워

답변1

에서 \usepackage[export]{adjustbox}옵션을 로드해서 사용하면 아주 간단합니다 .valign=c\includegraphics

\documentclass{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage[skins,listings,breakable,listingsutf8,theorems,hooks,fitting]{tcolorbox}%
\tcbuselibrary{most}
\usepackage{makecell,tabularx}
\setcellgapes{12pt}
\usepackage{array}
\usepackage{colortbl}
\tcbuselibrary{skins}

\usepackage{tikz}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

\tcbset{tableA/.style={
enhanced,
fonttitle=\bfseries,
fontupper=\normalsize\sffamily,
colback=blue!10!white,
colframe=green!50!black,
colbacktitle=red!40!white,
coltitle=black,center title}}

\usepackage[export]{adjustbox}

\begin{document}
\begin{tcbraster}[colback=red!5!white,colframe=red!75!black,
fonttitle=\bfseries,fontlower=\itshape] %
{
\makegapedcells
\begin{tcolorbox}[tableA,tabularx*={\renewcommand{\arraystretch}{1.5}}{Y|Y|},title={This is a table},boxrule=0.8pt]
A & B          \\\hline
A   & \includegraphics[width = 2cm, valign=c]{"example-image-a"}   \\\hline
A & AAA  \\\hline
B  & BBB  \\\hline
A   & \includegraphics[width = 2cm, valign=c]{"example-image-b"} 
\end{tcolorbox}
}
\end{tcbraster}


\end{document}

여기에 이미지 설명을 입력하세요

관련 정보