
나는 이런 긴 테이블을 갖고 싶다.
\begin{center}
\begin{longtable}{|p{2cm}|p{3cm}|p{7cm}|p{3cm}|}
\caption{my caption}
\hline
1 & 2 & 3 & 4\\
\hline
\hline
1 & 2 & 3 & 4\\
\hline
1 & 2 & 3 & 4\\
\hline
.
.
.
1 & 2 & 3 & 4\\
\hline
\label{variability_impl_mech}
\end{longtable}
\end{center}
하지만 이것을 컴파일하려고 하면 다음 오류가 발생합니다: !Misplaced \noalign
마지막 \hline 다음에 캡션을 쓰면 정상적으로 작동합니다. 테이블 위에 캡션을 표시하고 싶은데 이 오류가 나타납니다.
답변1
\begin{longtable}{|p{2cm}|p{3cm}|p{7cm}|p{3cm}|}
\caption{my caption}\\ %%%%<===
\hline
그리고 더 의미가 있는 \label
after 를 넣어야 합니다 .\caption
답변2
또 다른 방법: 헤드와 첫 번째 헤드를 사용합니다.
\documentclass{article}
\usepackage{longtable}
\begin{document}
\begin{longtable}{|p{2cm}|p{3cm}|p{7cm}|p{3cm}|}
\caption{my caption}
\label{variability_impl_mech}
\endfirsthead
\endhead
\hline
1 & 2 & 3 & 4\\
%\hline
\hline
1 & 2 & 3 & 4\\
\hline
1 & 2 & 3 & 4\\
\hline
.
.
.
1 & 2 & 3 & 4\\
\hline
\end{longtable}
\end{document}
답변3
Python에서 라이브러리 pandas를 사용하여 테이블을 생성했기 때문에 문제가 있었습니다. 이런 식으로.
print(tabla_1.to_latex(index = False, longtable=True))
하지만 문제는 팬더가 이런 방식으로 긴 테이블을 생성한다는 것입니다.
\begin{longtable}{lrrr}
\toprule
Nombre & No datos & P. rango & total\_isnull \\
\midrule
\label
그래서 나는 and \caption
before 를 넣으려고 했지만 \toprule
결코 컴파일되지 않았습니다. 그래서 내 솔루션은 변경되었으며 \toprule
다음 \hline
과 같은 컴파일이 가능합니다.
\begin{longtable}{lrrr}
\label{YourLabel}
\Caption{YourCaption}
\hline
Nombre & No datos & P. rango & total\_isnull \\
\midrule