이 게시판의 권장 사항에 따라 실험실 보고서에서 pgfplotstable을 사용하여 CSV에서 데이터를 가져오고 LaTeX의 테이블로 인쇄하기로 결정했습니다. 그러나 내 부록과 같은 섹션에서는 테이블이 제목 아래(머리 위가 아님)에 있어야 하는데 어떻게 LaTeX가 코드에 있는 위치에 테이블을 배치하도록 강제할 수 있습니까?
견본:
\appendix
\appendixpage
\section{Tables}
\begin{subappendices}
\subsection{Heading 1}
\pgfplotstableread{mydata.csv}{\mydatalabel}
\begin{table}
\centering
\caption[LoT Caption]{Full Caption}
\pgfplotstabletypeset[%
every head row/.style={
before row=\toprule, after row=\midrule},
every last row/.style={
after row=\bottomrule},
]{\mydatalabel}
\label{table:mydatalabel}
\end{table}
LaTeX는 자동 서식을 지정하고 표를 제목 1(및 다른 제목) 위에 배치합니다.
pgfplotstables를 사용하기 전에 테이블에 이 코드를 사용하여 테이블을 원래 위치에 강제로 적용했습니다.
\begin{center}
\captionof{table}[LoT Caption]{Full Caption}
\begin{tabular}{c c c c}
\toprule
\bottomrule
\label{table:mydatalabel} \\
\end{tabular}
\end{center}
내가 할 수 있는 비슷한 일이 있나요? 나는 더 이상 테이블에 데이터를 수동으로 입력할 필요가 없기 때문에 지금까지 pgfplotstables를 사용하는 것을 정말 좋아합니다.
답변1
\pgfplotstabletypeset
환경 내부에서는 아무것도 사용할 필요가 없습니다 table
. tabular
환경이 사용되는 어느 곳에서나 사용할 수 있습니다 .
마지막 코드 조각의 환경 \label
내부에 나타나는 명령 으로 인해 중단될 수 있습니다 . tabular
이에 대한 요구 사항도 없습니다. \label
오는 한~ 후에, 예상 \caption
대로 작동합니다.
그래서 여기에 그것이 수행될 수 있는 방법이 있습니다. 저는 pgfplotstable
귀하의 데이터 파일에 접근할 수 없기 때문에 매뉴얼 의 예제 데이터 파일을 사용했습니다 :
\documentclass{article}
\usepackage{capt-of,pgfplotstable}
\pgfplotsset{compat=1.12}
\begin{document}
Table~\ref{table:mydata} is typeset just fine by \verb|pgfplotstable|,
even outside of a \verb|table| environment.
\begin{center}
\captionof{table}[Short Caption]{This is the full, long-form caption.}
\label{table:mydata}
\pgfplotstabletypeset[columns={dof,error1}]{pgfplotstable.example1.dat}
\end{center}
\end{document}