\documentclass{article}
\usepackage[letterpaper]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage[spanish]{babel}
\usepackage{tabularx}
\usepackage{array}
\usepackage{adjustbox}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{multirow}
\usepackage{caption}
\graphicspath{ {images/} }
\special{papersize=8.5in,11in}
\usepackage{float}
\usepackage{multicol}
\usepackage[caption = false]{subfig}
\usepackage{geometry}
\begin{table}[h!]
\centering
\begin{tabular}{|c c|}
\hline
Parameter & Intensity [mW] \\
\hline \hline
$I_0(0,0)$ & $0.23$ \\
\hline
$I_0(0,0)$ & $0.23$ \\
\hline
$I_0(0,0)$ & $0.23$ \\
\hline
$I_0(0,0)$ & $0.23$ \\
\hline
$I_0(0,0)$ & $0.23$ \\
\hline
$I_0(0,0)$ & $0.23$ \\
\hline
\end{tabular}
\caption{Intensidades}
\label{intSt}
\end{table}
當我刪除\begin{table}
&時,\end{table}
表格確實出現,但我無法添加\caption
或\label
。有誰知道如何讓表格出現\begin{table}
& \end{table}
?
答案1
\begin{document}
將說明新增至您的程式碼後,我無法複製您描述的問題\end{document}
。我只能假設(並希望...)您實際嘗試排版的表格與您發布的“虛擬”表格不同。
無論如何,我會努力提高表格的清晰度,例如,省略所有\hline
指令,而是加載booktabs
套件並繪製更少但間隔良好的線條。從 a 環境切換tabular
到 a環境將大大減少整個表中使用的符號array
數量,從而提高程式碼的可讀性。$
\documentclass{article}
\usepackage[letterpaper]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{blindtext} % do you really need this?
\usepackage[spanish]{babel}
\usepackage{tabularx}
%%\usepackage{array} % is loaded automatically by 'tabularx'
\usepackage{adjustbox} % do you reall need this package?
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{multirow}
%%\usepackage{caption}
\graphicspath{ {images/} }
%%\special{papersize=8.5in,11in}
\usepackage{float}
\usepackage{multicol}
%%\usepackage[caption = false]{subfig}
%%\usepackage{geometry}
\usepackage{booktabs} % <-- new
\begin{document}
\begin{table}[h!]
\centering
$\begin{array}{@{}cc@{}}
\toprule
$Parameter$ & $Intensity [mW]$ \\
\midrule
I_0(0,0) & 0.23 \\
I_1(0,0) & 0.23 \\
I_2(0,0) & 0.23 \\[0.75ex]
I_4(0,0) & 0.23 \\
I_4(0,0) & 0.23 \\
I_5(0,0) & 0.23 \\
\bottomrule
\end{array}$
\caption{Intensidades}\label{intSt}
\end{table}
\end{document}
答案2
固定使用:
\begin{wraptable}{l}{0.7\linewidth}
\centering
\begin{tabular}{|c | c|}
\hline
Parámetros & Intensidades [mW] \\
\hline
$I(0,0)$ & $0.23$ \\
$I(\frac{\pi}{4},0)$ & $0.25$ \\
$I(\frac{\pi}{2},0)$ & $0.27$ \\
$I(\frac{3\pi}{4},0)$ & $0.26$ \\
$I(\frac{\pi}{4},\frac{\pi}{2})$ & $0.23$ \\
$I(\frac{3\pi}{4},\frac{\pi}{2})$ & $0.23$ \\
\hline
\end{tabular}
\caption{Intensidades}
\label{intSt}
\end{wraptable}