
간단한 테이블을 만들기 위해 Tabular를 사용하고 있습니다. 세 개의 열에 대해 내 테이블이 제대로 표시되었습니다. 네 번째 열을 추가했을 때 수평선이 테이블 전체에 닿지 않았습니다. 또한 테이블 왼쪽에 약간의 수평선이 튀어나와 있습니다. 내 테이블에 무슨 문제가 생겼나요?
\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
테이블 내용이 주어진 너비를 초과했다는 것입니다. 멈추기 \hlines
를 원했지만 텍스트는 멈추지 않았습니다. p{}
-columns를 사용하여 열 너비를 줄이거 tabularx
나 tabular*
.
답변2
테이블 왼쪽에 튀어나온 수평선을 제거하려면 둘이 |
아닌 하나만 사용하면 됩니다.||
\begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill } } | l | c | c | c || }
따라서 코드는 다음과 같아야 합니다.
\begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill } } | l | c | c | c | }