![表格,表格在下一行,因为它水平方向太长](https://linux22.com/image/386633/%E8%A1%A8%E6%A0%BC%EF%BC%8C%E8%A1%A8%E6%A0%BC%E5%9C%A8%E4%B8%8B%E4%B8%80%E8%A1%8C%EF%BC%8C%E5%9B%A0%E4%B8%BA%E5%AE%83%E6%B0%B4%E5%B9%B3%E6%96%B9%E5%90%91%E5%A4%AA%E9%95%BF.png)
这就是我要的!
但是我的代码不起作用,它看起来像这样
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[spanish,es-tabla]{babel} % espanol
\decimalpoint
\usepackage[utf8]{inputenc}
\usepackage{graphicx} % graficos
\usepackage{amsmath}
\usepackage{listings}
\usepackage{tikz} %era para hacer los grafos pero no investigué mucho asi que lo hice con word
\usetikzlibrary{arrows}
%Header an Footer Stuff
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyfoot[R]{ \thepage\ }
%Hyperlink
\usepackage{varioref}
\usepackage{hyperref}
\usepackage{cleveref}
\hypersetup{colorlinks=false}
\hypersetup{pdfborder={0 0 0}}
\begin{document}
\begin{table}[htbp]
\caption{Valores optimos Ejercicio 2}
\begin{tabular}{| l | l | l | l | l | l | l | l | l | l | l | l | l | l | l | l | l |}
\hline
$x_{ij}$ & 1-2 & 1-3 & 1-5 & 2-3 & 2-4 & 2-8 & 3-4 & 3-5 & 4-7 & 4-8 & 5-6 & 5-9\\
\hline
Valor & 30 & 15 & 14 & 7 & 7 & 16 & 12 & 10 & 7 & 12\\
\hline
\end{tabular}\hspace{0pt}%
\begin{tabular}{l l | l | l | l | l | l | l | l |}
\hline
2-4 & 2-8 & 3-4 & 3-5 & 4-7 & 4-8 & 5-6 & 5-9\\
\hline
1111 & 8 & 5 & 11 & 12 & 28 & 19 & 0\\
\hline
\end{tabular}\hspace{0pt}%
\label{tab:vo-ej2}
\end{table}
\end{document}
答案1
如果您希望有人阅读并理解您的表格,您可能需要重新设计它。您认为如何:
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[spanish]{babel}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{caption}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{table}
\centering
\caption{Valores óptimos Ejercicio 2}\label{tab:voed}
\begin{tabular}{c S[table-format=2.0]}
\toprule
$x_{ij}$ & {Valor} \\
\midrule
1-2 & 30 \\
1-3 & 15 \\
1-5 & 14 \\
$\vdots$ & {$\vdots$} \\
4-8 & 12 \\
\bottomrule
\end{tabular}\qquad
\begin{tabular}{c S[table-format=4.0]}
\toprule
$x_{ij}$ & {Valor} \\
\midrule
5-6 & \\
5-9 & \\
2-4 & 1111 \\
$\vdots$ & {$\vdots$} \\
5-9 & 0 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}