
현재 일부 게이트와 해당 작업을 요약한 표가 있지만 모양이 이상하고 형식이 올바르지 않습니다. 이미지와 텍스트를 정렬하는 방법을 아는 사람이 있나요? 또한 '효과' 열에서 텍스트를 다른 텍스트 아래에 표시하고 싶습니다. 아래 라텍스 코드와 첨부된 이미지를 참조하세요.
\begin{figure}
\centering
\begin{threeparttable}
\begin{tabular}{cccc}
%{m{15mm} m{70mm} m{18mm}}
Gates & Circuit Symbol & Matrix Representation & Effect\\
\midrule\midrule
Pauli-X &
\includegraphics[scale = 1 , trim= {50 50 32 25}, clip
]{Chapter2/Figs/Raster/x.png} &
$U(\pi, 0 , \pi) =
\begin{pmatrix}
0 & 1 \\
1& 0
\end{pmatrix}$ &
\begin{itemize}
\item $\emph{X}\ket{0}\longrightarrow\ket{1}$
\item $\emph{X}\ket{1}\longrightarrow\ket{0}$
\end{itemize}
\\%new row
Pauli-Y &
\includegraphics[scale = 1 , trim= {50 50 32 25}, clip
]{Chapter2/Figs/Raster/y.png} &
$U(\pi , \frac{\pi}{2},\frac{\pi}{2}) =
\begin{pmatrix}
0 & -i \\
i & 0
\end{pmatrix}$ &
\begin{itemize}
\item $\emph{Y}\ket{0}\longrightarrow i\ket{1}$
\item $\emph{Y}\ket{1}\longrightarrow-i\ket{0}$,
\end{itemize}
\\%new row
Pauli-Z &
\includegraphics[scale = 1 , trim= {50 50 32 25}, clip
]{Chapter2/Figs/Raster/z.png} &
$U(0 , 0 , \pi) =
\begin{pmatrix}
1 & 0 \\
0 & -1
\end{pmatrix}$ &
\begin{itemize}
\item $\emph{Z}\ket{0}\longrightarrow\ket{0}$
\item $\emph{Z}\ket{1}\longrightarrow-\ket{1}$
\end{itemize}
\\%new row
Hadamard &
\includegraphics[scale = 1 , trim= {50 50 32 25}, clip
]{Chapter2/Figs/Raster/h.png} &
$U(\frac{\pi}{2},0 , \pi) = \frac{1}{\sqrt{2}}
\begin{pmatrix}
1 & 1 \\
1 & -1
\end{pmatrix}$ &
\begin{itemize}
\item $\emph{H}\ket{0}\longrightarrow \frac{1}{\sqrt{2}}(\ket{0}+\ket{1})$
\item $\emph{H}\ket{1}\longrightarrow \frac{1}{\sqrt{2}}(\ket{0}-\ket{1})$ \end{itemize}
\\% end of rows
\midrule\midrule
\end{tabular}
\begin{tablenotes}
\caption{Names, circuit symbols and unitary matrix representation for common single qubit gates.}
\end{tablenotes}
\end{threeparttable}
\end{figure}
답변1
\raisebox{-0.5\height}
이미지를 테이블 셀 내부의 수직 중앙 에 배치하려면 \includegraphics
. 간단한 테이블과 표준 예제 이미지를 사용하면 이것이 있든 없든 얻을 수 있는 것입니다.\raisebox{-0.5\height}
완전한 코드는 다음과 같습니다
\documentclass[leqno]{article}
\usepackage{graphicx}
\usepackage{booktabs}
\begin{document}
%
%
\begin{table}
\centering
\caption{Vertical centering of figures in cells.}
\begin{tabular}{lll}
\toprule
Column1 & Column2 & Column3 \\
\midrule
Cols1 & \raisebox{-0.5\height}{\includegraphics[width=2cm]{example-image}} & Cols3 \\
Cols1 & \raisebox{-0.5\height}{\includegraphics[width=4cm]{example-image}} & Cols3 \\
Cols1 & Cols2 & Cols3 \\
\bottomrule
\end{tabular}
\end{table}
%
\begin{table}
\centering
\caption{NO vertical centering of figures in cells.}
\begin{tabular}{lll}
\toprule
Column1 & Column2 & Column3 \\
\midrule
Cols1 & \includegraphics[width=2cm]{example-image} & Cols3 \\
Cols1 & \includegraphics[width=4cm]{example-image} & Cols3 \\
Cols1 & Cols2 & Cols3 \\
\bottomrule
\end{tabular}
\end{table}
%
\end{document}
행운을 빌어요!
답변2
valign=c
패키지 와 함께 제공되는 사용 제안은 다음과 같습니다 adjustbox
. 또한 itemize
이 테이블 내부에서 사용할 수 있도록 사용자 정의 버전을 추가했습니다 .
\documentclass{article}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{amsmath}
\usepackage{booktabs}
%\usepackage{threeparttable}
\usepackage{array}
\usepackage{physics}
\usepackage{enumitem}
\newlist{tabitem}{itemize}{1}
\setlist[tabitem]{wide=0pt, leftmargin= * ,label=\textbullet}
\begin{document}
\begin{figure}
\centering
% \begin{threeparttable}
\begin{tabular}{cccm{37mm}}
%{m{15mm} m{70mm} m{18mm}}
Gates & Circuit Symbol & Matrix Representation & Effect\\
\midrule\midrule
Pauli-X &
\includegraphics[width=1cm, valign=c]{example-image} &
$U(\pi, 0 , \pi) =
\begin{pmatrix}
0 & 1 \\
1& 0
\end{pmatrix}$ &
\begin{tabitem}
\item $\emph{X}\ket{0}\longrightarrow\ket{1}$
\item $\emph{X}\ket{1}\longrightarrow\ket{0}$
\end{tabitem}
\\%new row
Pauli-Y &
\includegraphics[width=1cm, valign=c]{example-image} &
$U(\pi , \frac{\pi}{2},\frac{\pi}{2}) =
\begin{pmatrix}
0 & -i \\
i & 0
\end{pmatrix}$ &
\begin{tabitem}
\item $\emph{Y}\ket{0}\longrightarrow i\ket{1}$
\item $\emph{Y}\ket{1}\longrightarrow-i\ket{0}$,
\end{tabitem}
\\%new row
Pauli-Z &
\includegraphics[width=1cm, valign=c]{example-image} &
$U(0 , 0 , \pi) =
\begin{pmatrix}
1 & 0 \\
0 & -1
\end{pmatrix}$ &
\begin{tabitem}
\item $\emph{Z}\ket{0}\longrightarrow\ket{0}$
\item $\emph{Z}\ket{1}\longrightarrow-\ket{1}$
\end{tabitem}
\\%new row
Hadamard &
\includegraphics[width=1cm, valign=c]{example-image} &
$U(\frac{\pi}{2},0 , \pi) = \frac{1}{\sqrt{2}}
\begin{pmatrix}
1 & 1 \\
1 & -1
\end{pmatrix}$ &
\begin{tabitem}
\item $\emph{H}\ket{0}\longrightarrow \frac{1}{\sqrt{2}}(\ket{0}+\ket{1})$
\item $\emph{H}\ket{1}\longrightarrow \frac{1}{\sqrt{2}}(\ket{0}-\ket{1})$
\end{tabitem}
\\% end of rows
\midrule\midrule
\end{tabular}
% \begin{tablenotes}
%
%\end{tablenotes}
%\end{threeparttable}
\caption{Names, circuit symbols and unitary matrix representation for common single qubit gates.}
\end{figure}
\end{document}