¿Cómo puedo dividir una sección de la página en tres partes?

¿Cómo puedo dividir una sección de la página en tres partes?

Estoy trabajando en el documento LaTex y resulta que estoy usando tres tablas pequeñas que quiero colocar en solo una parte de la página, no quiero dividir toda la página. Así es como se ve ahora mismo:

ingrese la descripción de la imagen aquí

Y quiero que se coloquen todos en una fila horizontal y este es mi código hasta ahora.

\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}

¡¡¡Gracias de antemano!!! :)

Respuesta1

Es muy sencillo con el floatrow paquete y su entorno homónimo:

    \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} 

ingrese la descripción de la imagen aquí

Respuesta2

  • No proporciona información sobre la clase de documento usado ni sobre el diseño de página...
  • Usar articlecon diseño de página predeterminado y minipáginas proporciona:

ingrese la descripción de la imagen aquí

\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}

Apéndice: Quizás te guste el siguiente diseño de tablas verdaderas:

\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}

ingrese la descripción de la imagen aquí

información relacionada