
Tabular を使用して簡単な表を作成しています。3 列の場合、表は正常に表示されました。4 列目を追加すると、水平線が表全体に届かなくなりました。また、表の左側に少しだけ水平線がはみ出ています。表の何が問題なのでしょうか?
\begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill } } | l | c | c | c || }
\hline
\textbf{GENE} & \textbf{Allele of interest} & \textbf{Outcomes} & \textbf{Dominance} \\
\hline \hline
MAOA & 2.5, 3, 5 & Agression & Recessive, Sex-selective \\ \hline
DAT1 & 10R & ADHD & hz. disadvantage \\ \hline
DRD4 & 7R & ADHD & - \\ \hline
5-HTT & 14 (s) & Negative Thoughts, Fear & Dominant \\ \hline
TRI & S & Depression & Codominant \\ \hline
DRD2 & A & Alcoholism & Dominant \\ \hline
DRD5 & 148 & ADHD & - \\ \hline
S000005 & A & Stress & - \\ \hline
S000006 & T & ADHD & - \\ \hline
MAOCA1 & 115+ & Alcoholism & Sex selective \\ \hline
\end{tabular*}
答え1
もしよろしければ、テーブル全体を再設計することをお勧めします。上記に掲載されているコードは幅が広すぎます。
% arara: pdflatex
\documentclass{article}
\usepackage{showframe} % for demo that the table fits into the page limits
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\caption{the caption}
\begin{tabular}{lp{1.5cm}ll}
\toprule
\textbf{GENE} & \textbf{Allele of interest} & \textbf{Outcomes} & \textbf{Dominance} \\
\midrule
MAOA & 2.5, 3, 5 & Agression & Recessive, Sex-selective \\
DAT1 & 10R & ADHD & hz.\ disadvantage \\
DRD4 & 7R & ADHD & - \\
5-HTT & 14 (s) & Negative Thoughts, Fear & Dominant \\
TRI & S & Depression & Codominant \\
DRD2 & A & Alcoholism & Dominant \\
DRD5 & 148 & ADHD & - \\
S000005 & A & Stress & - \\
S000006 & T & ADHD & - \\
MAOCA1 & 115+ & Alcoholism & Sex selective \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
テーブルの問題は、指定された の幅が0.75\textwidth
テーブルの内容によって超過していることです。 は停止したい場所で停止しましたが、テキストは停止しませんでした。 -columns を使用して列の幅を減らすか、の代わりにを使用する\hlines
必要があります。p{}
tabularx
tabular*
答え2
テーブルの左側に突き出ている横線を削除するには、|
2つではなく1つだけ使用する必要があります。||
\begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill } } | l | c | c | c || }
したがって、コードは次のようになります。
\begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill } } | l | c | c | c | }