
私は LaTex 論文に取り組んでいますが、ページ全体を分割するのではなく、ページの一部に収めたい小さな表を 3 つ使用しています。現在の状態は次のとおりです。
そして、それらをすべて水平方向に一列に配置したいのですが、これがこれまでの私のコードです。
\noindent
\textbf{Escriba las tablas de verdad de una compuerta OR, AND y XOR.}
% compuerta OR
\begin{table}[ht!]
\centering
\caption{Compuerta OR}
\label{tab1}
\begin{tabular}{|c|c|c|}
\hline
\textbf{A} & \textbf{B} & \textbf{Output} \\ \hline
0 & 0 & 0 \\ \hline
0 & 1 & 1 \\ \hline
1 & 0 & 1 \\ \hline
1 & 1 & 1 \\ \hline
\end{tabular}
\end{table}
% compuerta AND
\begin{table}[ht!]
\centering
\caption{Compuerta AND}
\label{tab2}
\begin{tabular}{|c|c|c|}
\hline
\textbf{A} & \textbf{B} & \textbf{Output} \\ \hline
0 & 0 & 0 \\ \hline
0 & 1 & 0 \\ \hline
1 & 0 & 0 \\ \hline
1 & 1 & 1 \\ \hline
\end{tabular}
\end{table}
% compuerta XOR
\begin{table}[ht!]
\centering
\caption{Compuerta XOR}
\label{tab3}
\begin{tabular}{|c|c|c|}
\hline
\textbf{A} & \textbf{B} & \textbf{Output} \\ \hline
0 & 0 & 0 \\ \hline
0 & 1 & 1 \\ \hline
1 & 0 & 1 \\ \hline
1 & 1 & 0 \\ \hline
\end{tabular}
\end{table}
前もって感謝します!!! :)
答え1
floatrow
パッケージとその同名の環境を使用すると非常にシンプルになります。
\documentclass{article}
\usepackage{floatrow}
\begin{document}
\noindent
\textbf{Escriba las tablas de verdad de una compuerta OR, AND y XOR.}
% compuerta OR
\begin{table}[ht!]
\begin{floatrow}[3]
\centering
\ttabbox{\caption{Compuerta OR}\label{tab1}}%
{\begin{tabular}{|c|c|c|}
\hline
\textbf{A} & \textbf{B} & \textbf{Output} \\ \hline
0 & 0 & 0 \\ \hline
0 & 1 & 1 \\ \hline
1 & 0 & 1 \\ \hline
1 & 1 & 1 \\ \hline
\end{tabular}}
% compuerta AND
\ttabbox{\caption{Compuerta AND}\label{tab2}}%
{\begin{tabular}{|c|c|c|}
\hline
\textbf{A} & \textbf{B} & \textbf{Output} \\ \hline
0 & 0 & 0 \\ \hline
0 & 1 & 0 \\ \hline
1 & 0 & 0 \\ \hline
1 & 1 & 1 \\ \hline
\end{tabular}}
%
\ttabbox{\caption{Compuerta XOR}\label{tab3}}%
{\begin{tabular}{|c|c|c|}
\hline
\textbf{A} & \textbf{B} & \textbf{Output} \\ \hline
0 & 0 & 0 \\ \hline
0 & 1 & 1 \\ \hline
1 & 0 & 1 \\ \hline
1 & 1 & 0 \\ \hline
\end{tabular}}
\end{floatrow}
\end{table}
\end{document}
答え2
- ページレイアウトではなく、使用されているドキュメントクラスについては提供されていません...
article
デフォルトのページ レイアウトとミニ ページを使用すると、次のようになります。
\documentclass{article}
\usepackage[skip=1ex, font=small]{caption} % <---
\begin{document}
\noindent
\textbf{Escriba las tablas de verdad de una compuerta OR, AND y XOR.}
\begin{table}[ht!]
\begin{minipage}{0.3\linewidth}\centering
\caption{Compuerta OR}
\label{tab1}
\begin{tabular}{|c|c|c|}
\hline
\textbf{A} & \textbf{B} & \textbf{Output} \\ \hline
0 & 0 & 0 \\ \hline
0 & 1 & 1 \\ \hline
1 & 0 & 1 \\ \hline
1 & 1 & 1 \\ \hline
\end{tabular}
\end{minipage}
\hfill
\begin{minipage}{0.3\linewidth}\centering
\caption{Compuerta AND}
\label{tab2}
\begin{tabular}{|c|c|c|}
\hline
\textbf{A} & \textbf{B} & \textbf{Output} \\ \hline
0 & 0 & 0 \\ \hline
0 & 1 & 0 \\ \hline
1 & 0 & 0 \\ \hline
1 & 1 & 1 \\ \hline
\end{tabular}
\end{minipage}
\hfill
\begin{minipage}{0.3\linewidth}\centering
\caption{Compuerta XOR}
\label{tab3}
\begin{tabular}{|c|c|c|}
\hline
\textbf{A} & \textbf{B} & \textbf{Output} \\ \hline
0 & 0 & 0 \\ \hline
0 & 1 & 1 \\ \hline
1 & 0 & 1 \\ \hline
1 & 1 & 0 \\ \hline
\end{tabular}
\end{minipage}
\end{table}
\end{document}
補遺: 次のような真のテーブルのデザインが気に入るかもしれません。
\documentclass{article}
\usepackage[skip=1ex, font=small]{caption}
\usepackage{tabularray}
\begin{document}
\noindent
\textbf{Escriba las tablas de verdad de una compuerta OR, AND y XOR.}
\begin{table}[ht!]
\begin{minipage}{0.3\linewidth}\centering
\caption{Compuerta OR}
\label{tab1}
\begin{tblr}{colspec = { c c|c },
row{1} = {font=\bfseries}
}
A & B & Output \\
\hline
0 & 0 & 0 \\
0 & 1 & 1 \\
1 & 0 & 1 \\
1 & 1 & 1 \\
\end{tblr}
\end{minipage}
\hfill
\begin{minipage}{0.3\linewidth}\centering
\caption{Compuerta AND}
\label{tab2}
\begin{tblr}{colspec = { c c|c },
row{1} = {font=\bfseries}
}
A & B & Output \\
\hline
0 & 0 & 0 \\
0 & 1 & 0 \\
1 & 0 & 0 \\
1 & 1 & 1 \\
\end{tblr}
\end{minipage}
\hfill
\begin{minipage}{0.3\linewidth}\centering
\caption{Compuerta XOR}
\label{tab3}
\begin{tblr}{colspec = { c c|c },
row{1} = {font=\bfseries}
}
A & B & Output \\
\hline
0 & 0 & 0 \\
0 & 1 & 1 \\
1 & 0 & 1 \\
1 & 1 & 0 \\
\end{tblr}
\end{minipage}
\end{table}
\end{document}