如何將頁面的一部分分成三個部分?

如何將頁面的一部分分成三個部分?

我正在處理 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}

在此輸入影像描述

相關內容