\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
包并绘制更少但间距适当的行。从环境切换tabular
到环境将提高代码的可读性,因为可以大大减少整个表中使用的符号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}