
누군가 테이블 정리를 도와줄 수 있나요? TikZ 그림의 윤곽선과 테이블 선 사이에 거리를 두고 싶습니다. 게다가 TikZ가 아닌 사진은 중앙에 위치하지 않습니다.
내 LaTeX 코드는 다음과 같습니다.
\documentclass[a4paper,10pt]{article}
\usepackage{tikz,amsmath, amssymb,bm,color}
\usetikzlibrary{circuits.logic.US,circuits.logic.IEC}
\begin{document}
\begin{table}
\caption{Test}
\label{de:Wahrheitstabelle_Bsp01}
\setlength{\tabcolsep}{5mm} % separator between columns
\def\arraystretch{1.25} % vertical stretch factor
\centering
\begin{tabular}{|c|c|c|}
\hline
Gatter & Funktion & CNF-Formel \\ \hline
\begin{tikzpicture}
\draw (-1.5,-0.75) rectangle (1.5,0.75) ;
\end{tikzpicture} & 0 & 1 \\ \hline
\begin{tikzpicture}[circuit logic US, logic gate input sep=4mm]
\node [or gate, inputs =nn] (a1) {};
\draw (a1.input 1) -- ++(left:5mm) node[left] {$x_{1}$};
\draw (a1.input 2) -- ++(left:5mm) node[left] {$x_{2}$};
\draw (a1.output)--++(right:5mm) node[right] {$x_{3}$};
\end{tikzpicture} & 0 & 1 \\ \hline
\begin{tikzpicture}[circuit logic US]
\node (a1) [not gate, inputs =n] at (0,0) {};
\draw (a1.input) -- ++(left:5mm) node[left] {$x_{1}$};
\draw (a1.output)--++(right:5mm) node[right] {$x_{2}$};
\end{tikzpicture} & $x_{2} \equiv \neg x_{1}$ & $(x_{2} \vee x_{1}) \wedge (\neg x_{2} \vee \neg x_{1})$ \\ \hline
\end{tabular}
\end{table}
\end{document}
내 테이블은 다음과 같습니다.
답변1
tikzpicture 주변의 수직 여백을 수정하려면 fit
라이브러리와 특수 노드를 사용할 수 있습니다 current boundind box
. 다음 예에서 \addvmargin
매크로는 이 방법을 사용합니다.
tikzpicture의 수직 정렬을 수정하려면 baseline
옵션을 사용할 수 있습니다. 여기에서는 0
첫 번째 tikzpicture의 기준선을 선택했지만 수직 좌표를 선택할 수 있습니다. 마지막 두 개의 tikz그림에서는 임의의 노드를 참조로 선택합니다.
\documentclass[a4paper,10pt]{article}
\usepackage{tikz,amsmath, amssymb,bm,color}
\usetikzlibrary{circuits.logic.US,circuits.logic.IEC,fit}
\newcommand\addvmargin[1]{
\node[fit=(current bounding box),inner ysep=#1,inner xsep=0]{};
}
\begin{document}
\begin{table}
\caption{Test}
\label{de:Wahrheitstabelle_Bsp01}
\setlength{\tabcolsep}{5mm} % separator between columns
\def\arraystretch{1.25} % vertical stretch factor
\centering
\begin{tabular}{|c|c|c|}
\hline
Gatter & Funktion & CNF-Formel
\\ \hline
\begin{tikzpicture}[baseline=0]
\draw (-1.5,-0.75) rectangle (1.5,0.75) ;
\addvmargin{1mm}
\end{tikzpicture} & 0 & 1
\\ \hline
\begin{tikzpicture}[baseline={(x3.base)},circuit logic US,logic gate input sep=4mm]
\node [or gate, inputs =nn] (a1) {};
\draw (a1.input 1) -- ++(left:5mm) node[left] {$x_{1}$};
\draw (a1.input 2) -- ++(left:5mm) node[left] {$x_{2}$};
\draw (a1.output)--++(right:5mm) node[right] (x3) {$x_{3}$};
\addvmargin{1mm}
\end{tikzpicture} & 0 & 1
\\ \hline
\begin{tikzpicture}[baseline={(x1.base)},circuit logic US]
\node (a1) [not gate, inputs =n] at (0,0) {};
\draw (a1.input) -- ++(left:5mm) node[left] (x1) {$x_{1}$};
\draw (a1.output)--++(right:5mm) node[right] {$x_{2}$};
\addvmargin{1mm}
\end{tikzpicture} & $x_{2} \equiv \neg x_{1}$ & $(x_{2} \vee x_{1}) \wedge (\neg x_{2} \vee \neg x_{1})$
\\ \hline
\end{tabular}
\end{table}
\end{document}