pgfplotsstable의 열 이름에 액세스할 수 없습니다.

pgfplotsstable의 열 이름에 액세스할 수 없습니다.

나는 pgfplotstable의 열 이름에 액세스하는 표준 방법(내가 아는 한)을 따랐지만 작동하지 않는 것 같습니다.

코드는 다음과 같습니다.

\begin{figure}[H]
\pgfplotstabletypeset[
    col sep=comma,
    string type,
    columns/name/.style={column name=$\epsilon$, column type={|c|}},
    columns/surname/.style={column name=$\phi$, column type={|c|}},
    every head row/.style={before row=\hline,after row=\hline},
    every last row/.style={after row=\hline},
    ]{test.csv}
\caption{Results}
\end{figure}

그리고 이것이 생성되는 것입니다: 여기에 이미지 설명을 입력하세요

\phi거기에 and 가 있어야 하는데 \epsilon그렇지 않습니다. 이것은 test.csv 데이터 파일에 포함된 내용입니다.

parameter,test
1,2
1,2
1,3

도와 주셔서 감사합니다.

답변1

적절한 열 헤더 이름을 사용해야 합니다. 열에 이름이 parametertest있지만 사용하고 있습니다 namesurname. 다음으로 변경하세요.

    columns/parameter/.style={column name=$\epsilon$, column type={|c|}},
    columns/test/.style={column name=$\phi$, column type={|c|}},

암호:

\documentclass{article}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.10}
\usepackage{filecontents}
\begin{filecontents*}{test.csv}
  parameter,test
    1,2
    1,2
    1,3
\end{filecontents*}
\begin{document}
  \begin{figure}[H]        %% why figure?
  \centering
\pgfplotstabletypeset[
    col sep=comma,
    string type,
    columns/parameter/.style={column name=$\epsilon$, column type={|c|}},
    columns/test/.style={column name=$\phi$, column type={c|}},
    every head row/.style={before row=\hline,after row=\hline},
    every last row/.style={after row=\hline},
    ]{test.csv}
\caption{Results}
\end{figure}
\end{document}

여기에 이미지 설명을 입력하세요

나는 또한 (테스트를 위해) 두 번째를 수정했습니다 column type={c|}.

관련 정보