La mesa se ve fea

La mesa se ve fea

Estoy intentando crear una tabla que tenga cuatro columnas, pero la tabla tiene un aspecto algo feo.

\documentclass[%
 preprint,
 doublecolumn
%superscriptaddress,
%groupedaddress,
%unsortedaddress,
%runinaddress,
%frontmatterverbose, 
%preprint
%preprintnumbers,
%nofootinbib,
%nobibnotes,
%bibnotes,
 amsmath,amssymb,
 aps,
%pra,
prc,
%rmp,
%prstab,
%prstper,
%floatfix,
]{revtex4-2}
\usepackage{anyfontsize}
\usepackage{float}
\usepackage{mathtools, nccmath}
\usepackage{graphicx}% Include figure files
\usepackage{tabularx}
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
%\usepackage{hyperref}% add hypertext capabilities
\usepackage[mathlines]{lineno}% Enable numbering of text and display math
\usepackage{amsmath}
\linenumbers\relax % Commence numbering lines
%\usepackage{latexsym}
%\usepackage[showframe,%Uncomment any one of the following lines to test 
%%scale=0.7, marginratio={1:1, 2:3}, ignoreall,% default settings
%%text={7in,10in},centering,
%%margin=1.5in,
%%total={6.5in,8.75in}, top=1.2in, left=0.9in, includefoot,
%%height=10in,a5paper,hmargin={3cm,0.8in},
%]{geometry}

\begin{document}
\begin{ruledtabular}
\begin{tabular}{lcr} 
\textrm{$\theta$}& \textrm{$R(\theta)\pm \sigma R(\theta)$ }& \textrm{$Y(\theta) \pm \sigma {Y(\theta)}$} & \textrm{$\frac{Y(\theta)}{Y(0)}$ $\pm \sigma$ $\frac{Y(\theta)}{Y(0)}$ }\\
\colrule
0& 2.970$\pm$
10&2.774$\pm$
20&2.800$\pm$
30&2.526$\pm$
40&2.401$\pm$
50&2.399$\pm$
60&2.066$\pm$
70&2.174$\pm$
80&2.161$\pm$
90&2.091$\pm$
100&2.187$\pm$
110&2.272$\pm$
120&2.181$\pm$


\end{tabular}
\end{ruledtabular}
\end{table}

\end{document}

Si crea esta tabla, verá la parte

\textrm{$\frac{Y(\theta)}{Y(0)}$ $\pm \sigma$ $\frac{Y(\theta)}{Y(0)}$ } 

está en diferente lugar. ¿Me puedes ayudar?

Realmente aprecio su apoyo.

Respuesta1

Su código, tal como se publicó, tiene dos problemas graves y bastantes problemas menos graves.

  • Hay una \end{table}declaración pero no hay \begin{table}declaración.

  • La declaración \begin{tabular}{lcr}no puede ser correcta ya que configura solo tres columnas, mientras que el encabezado de la tabla solo presenta columnas. Te sugiero que emplee \begin{tabular}{lccc}.

  • La línea

    \textrm{$\theta$}& 
    \textrm{$R(\theta)\pm \sigma R(\theta)$ }& 
    \textrm{$Y(\theta) \pm \sigma {Y(\theta)}$} & 
    \textrm{$\frac{Y(\theta)}{Y(0)}$ $\pm \sigma$ $\frac{Y(\theta)}{Y(0)}$ }\\
    

    presenta no menos de cuatro [¡4!] \textrmenvoltorios completamente innecesarios. Deshazte de ellos.

  • La opción de clase de documento doublecolumnno se utiliza. De hecho, ¿podría ser un error? ¿Quizás deberías utilizar la opción twocolumn?

  • Si le preocupa que la tabla sea fea, debería considerar (a) deshacerse de la preprintopción y (b) no usar el ruledtabularentorno ni la \colrulemacro. En su lugar, cargue el booktabspaquete y aprenda a utilizar \toprule, \midruley \bottomrule. Y cambie de un entorno tabulara otro arraysin tener que escribir muchísimos $símbolos.

ingrese la descripción de la imagen aquí

\documentclass[%preprint,
 twocolumn, 
 %doublecolumn -- does this option exist?!
 amsmath,amssymb,aps,prc]{revtex4-2}

% I've omitted the entire remainder of your preamble 
% since none of its instructions get used in this MWE
% (minimum working example).

\usepackage{booktabs} % for \toprule, \midrule, \bottomrule macros
\usepackage{siunitx}  % for 'S' column type

\begin{document}
\begin{table}
\centering
$\begin{array}{@{} S[table-format=3.0] ccc @{}} 
\toprule
{\theta} & 
R(\theta)\pm \sigma R(\theta) & 
Y(\theta) \pm \sigma Y(\theta) & 
\frac{Y(\theta)}{Y(0)}\pm\sigma \frac{Y(\theta)}{Y(0)}\\
\midrule
  0 & 2.970\pm{}\\
 10 & 2.774\pm{}\\
 20 & 2.800\pm{}\\
 30 & 2.526\pm{}\\
 40 & 2.401\pm{}\\
 50 & 2.399\pm{}\\
 60 & 2.066\pm{}\\
 70 & 2.174\pm{}\\
 80 & 2.161\pm{}\\
 90 & 2.091\pm{}\\
100 & 2.187\pm{}\\
110 & 2.272\pm{}\\
120 & 2.181\pm{}\\
\bottomrule
\end{array}$
\end{table}

\end{document}

Respuesta2

Demasiado grande para colocarlo en un comentario :-)

Supongo que estás buscando algo como esto:

ingrese la descripción de la imagen aquí

(la mayoría de los números de la tabla son ficticios)

Su código tiene muchos problemas y errores graves (consulterespuesta mico). Para familiarizarse más con el escritorio, consulte algún texto introductorio como es, por ejemplo.Látex/Tablas.

Para la tabla anterior, el MWE es:

\documentclass[twocolumn]{revtex4-2}
\usepackage{nccmath, mathtools, amssymb}
\usepackage{array, makecell}
\usepackage{lipsum}

\begin{document}
\lipsum[1]
\[
    \setcellgapes{3pt}
    \makegapedcells
\begin{array}{rccc}
    \colrule
\theta
    &   R(\theta) \pm \sigma R(\theta)
        &   Y(\theta) \pm \sigma {Y(\theta)}
            &   \mfrac{Y(\theta)}{Y(0)} \pm \sigma\mfrac{Y(\theta)}{Y(0)}   \\
    \colrule
0   & 2.970 \pm 123 & 2.970 \pm 123 & 2.970 \pm 123 \\
10  & 2.774 \pm 123 & 2.774 \pm 123 & 2.774 \pm 123 \\
    \colrule
\end{array}
\]
\lipsum[2]
\end{document}

Puede servir como punto de partida en su esfuerzo por reescribir su tabla. Dado que todas las celdas están en modo matemático, para la tabla utilizo arrayla que está encapsulada en un entorno de ecuaciones.

Respuesta3

Siguiendo elMWE de Zarko, pero con siunitxy en modo texto (más o menos):

\documentclass{standalone}
\usepackage{nccmath, mathtools, amssymb}
\usepackage{array, booktabs, siunitx}
\usepackage{microtype}
\begin{document}
\sisetup{
separate-uncertainty,
table-format = 1.3(1),
}
%% don't forget to undo it:
\setlength{\tabcolsep}{12pt}

\begin{tabular}{rSSS[table-align-uncertainty = false]}
\midrule
0   & 2.970 \pm 123 & 2.970 \pm 123 & 2.970 \pm 123 \\
10  & 2.774 \pm 123 & 2.774 \pm 123 & 2.774 \pm 123 \\
\bottomrule
\end{tabular}
\end{document}

Ver tambiénestepara \tabcolsep.

captura de pantalla

información relacionada