.png)
나는 그런 텍스트 테이블을 가지고 있습니다 :
Descriptive statistics
=================================================================
Statistic N Mean St. Dev. Min Pctl(25) Median Pctl(75) Max
-----------------------------------------------------------------
MAE 540 2.1 1.2 0.5 1.0 1.8 2.9 4.4
RMSE 540 2.3 1.1 0.6 1.3 2.2 3.3 4.4
MAE (Top-5) 540 0.4 0.9 0.000 0.004 0.01 0.1 4.0
RMSE (Top-5) 540 0.4 0.9 0.001 0.004 0.01 0.2 4.0
-----------------------------------------------------------------
표준 명령을 통해 이 테이블을 참조하고 싶습니다 \ref{}
. 가능합니까? 텍스트(표)를 일반 표로 어떻게 수정해야 하나요?
답변1
tabular
나는 표 형식의 자료가 이미 또는 유사한 환경 에 있다고 가정하겠습니다 . 이 경우 다음과 같이 목표를 달성할 수 있습니다.
환경
tabular
내부에 환경 배치table
명령어 를 추가하세요
\caption
. 예:\caption{Descriptive Statistics}
\label{...}
지침 추가~ 후에지시\caption
사항(그러나 이전에\end{table}
최소한의 예:
....
\begin{table}
\caption{Descriptive Statistics}
\label{tab:desc_stats}
\centering
\begin{tabular}
...
\end{tabular}
\end{table}
...
답변2
적절한 표는 표준 텍스트 블록에 비해 약간 넓습니다.
실제로 표 형식 자료를 변환할 필요가 없으면 그대로 출력할 수 있습니다.
\documentclass{article}
\usepackage{blindtext}%optional
\usepackage{caption}%optional
\usepackage{booktabs}%optional
\captionsetup[table]{position=above}
\usepackage{siunitx}%optional
\usepackage{hyperref}%optional
\begin{document}
As can be seen in table~\ref{tab:statistics}, \blindtext
\begin{table}
\caption{Descriptive statistics}
\label{tab:statistics}
\begin{tabular}{lcS[table-format=1.1]
S[table-format=1.1]
S[table-format=1.3]
S[table-format=1.3]
S[table-format=1.2]
S[table-format=1.1]
S[table-format=1.1]
}
\toprule
{Statistic} & {N} & {Mean} & {St. Dev.} & {Min} & {Pctl(25)} & {Median} & {Pctl(75)} & {Max}\\
\midrule
MAE & 540 & 2.1 & 1.2 & 0.5 & 1.0 & 1.8 & 2.9 & 4.4\\
RMSE & 540 & 2.3 & 1.1 & 0.6 & 1.3 & 2.2 & 3.3 & 4.4\\
MAE (Top-5) & 540 & 0.4 & 0.9 & 0.000 & 0.004 & 0.01 & 0.1 & 4.0\\
RMSE (Top-5) & 540 & 0.4 & 0.9 & 0.001 & 0.004 & 0.01 & 0.2 & 4.0\\
\bottomrule
\end{tabular}
\end{table}
As can be seen in \autoref{tab:statisticsVerbatim}, \blindtext
\begin{table}[btp]
\caption{Descriptive statistics}
\label{tab:statisticsVerbatim}
\begin{verbatim}
=================================================================
Statistic N Mean St. Dev. Min Pctl(25) Median Pctl(75) Max
-----------------------------------------------------------------
MAE 540 2.1 1.2 0.5 1.0 1.8 2.9 4.4
RMSE 540 2.3 1.1 0.6 1.3 2.2 3.3 4.4
MAE (Top-5) 540 0.4 0.9 0.000 0.004 0.01 0.1 4.0
RMSE (Top-5) 540 0.4 0.9 0.001 0.004 0.01 0.2 4.0
-----------------------------------------------------------------
\end{verbatim}
\end{table}
\end{document}
답변3
실제로 환경을 사용하는 것을 좋아하지 않지만 table
테이블의 캡션과 참조를 사용하고 싶다면 \caption
패키지가 필요합니다. 원하는 형식으로 테이블을 작성할 수 있습니다. 그러면 다음과 같이 참조할 수 있습니다.
\documentclass{article}
\usepackage{caption}
\begin{document}
{\obeyspaces\ttfamily\small
\captionof{table}{Descriptive statistics}
\label{tab:stat}
\noindent\rule{.95\linewidth}{2pt}\\
Statistic N Mean St.Dev. Min Pctl(25) Median Pctl(75) Max\\
\noindent\rule{.95\linewidth}{1pt}\\
MAE 540 2.1 1.2 0.5 1.0 1.8 2.9 4.4\\
RMSE 540 2.3 1.1 0.6 1.3 2.2 3.3 4.4\\
MAE (Top-5) 540 0.4 0.9 0.000 0.004 0.01 0.1 4.0\\
RMSE (Top-5) 540 0.4 0.9 0.001 0.004 0.01 0.2 4.0\\
\noindent\rule{.95\linewidth}{1pt}\\
}
In Table~\ref{tab:stat}, we observe that ...
\end{document}