
Я работаю над бумагой LaTex и, как оказалось, использую три небольшие таблицы, которые я хочу поместить только на часть страницы, я не хочу делить всю страницу. Вот как это выглядит сейчас:
Я хочу, чтобы они были размещены в горизонтальный ряд. Вот мой код на данный момент.
\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}