
4 つの列を持つテーブルを作成しようとしていますが、テーブルの見た目が少々醜いです。
\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}
この表を作成すると、
\textrm{$\frac{Y(\theta)}{Y(0)}$ $\pm \sigma$ $\frac{Y(\theta)}{Y(0)}$ }
別の場所にいます。助けてもらえますか?
皆様のご支援に心より感謝申し上げます。
答え1
投稿されたコードには、2 つの重大な問題と、それほど重大ではない問題がいくつか存在します。
声明はある
\end{table}
が、声明はない\begin{table}
。\begin{tabular}{lcr}
テーブルのヘッダーだけで 列が指定されているのに、3 つの列しか設定されていないため、宣言は正しくありません。 を使用することをお勧めします\begin{tabular}{lccc}
。この線
\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)}$ }\\
まったく不要なラッパーが 4 つ以上あります [4 つ!]
\textrm
。これらを削除してください。ドキュメント クラス オプション
doublecolumn
が使用されていません。実際、これは間違いでしょうか? オプションを使用する必要があるのでしょうかtwocolumn
?テーブルが見苦しいことが気になる場合は、(a) オプションを削除することと、(b)環境とマクロを
preprint
使用しないことを検討してください。代わりに、パッケージをロードして、、、およびの使用方法を学習してください。そして、環境をから に切り替えて、大量の記号を入力しなくても済むようにしてください。ruledtabular
\colrule
booktabs
\toprule
\midrule
\bottomrule
tabular
array
$
\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}
答え2
コメントに載せるには大きすぎます :-)
次のようなものを探しているのではないかと思います:
(表の数字のほとんどはダミーです)
コードには多くの問題と重大なエラーがあります(ミコの回答)。ライティングテーブルに慣れるために、例えば以下のような入門テキストをご覧ください。LaTeX/表。
上記の押し出しテーブルの場合、MWE は次のようになります。
\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}
これは、テーブルを書き換える際の出発点として役立ちます。すべてのセルが数式モードになっているため、テーブルにはarray
方程式環境にカプセル化されたを使用します。
答え3
続いてMWE by Zarkoただし、siunitx
と をテキスト モード (ある意味) で使用します。
\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}
参照これのために\tabcolsep
。