csvsimple 랩 테이블 셀

csvsimple 랩 테이블 셀

csvsimple 패키지를 사용하여 csv 파일을 라텍스 문서에 테이블로 포함하고 있습니다.

긴 셀 내용이 렌더링을 중단시키는 것 같습니다.

토큰.csv:

method,corpus,tokens
MI,Quran,"allah, thou, thi, punish, believ, ye, thee, messeng, unbeliev, guid"
MI,OT,"allah, jesu, christ, thi, king, israel, believ, thou, lord, thee"
MI,NT,"jesu, christ, allah, ye, discipl, lord, thing, faith, israel, peter"
CHI²,Quran,"allah, punish, believ, messeng, unbeliev, guid, beli, disbeliev, vers, clear"
CHI²,OT,"allah, jesu, christ, thi, believ, king, israel, lord, thou, world"
CHI²,NT,"jesu, christ, discipl, ye, faith, thing, paul, peter, lord, allah"

main.tex:

\csvautotabular{tokens.csv}

다음으로 렌더링 여기에 이미지 설명을 입력하세요

세 번째 셀의 내용이 길기 때문에 가정합니다(셀 내용이 더 짧은 다른 CSV 삽입은 내 문서에서 제대로 렌더링됩니다).

이 문제를 어떻게 해결할 수 있나요?

CSV 파일은 다른 프로그램에서 바로 나오므로 편집할 필요가 없습니다.조금도, 또는 적어도 표준 CSV 형식과 호환되지 않게 만들지 마세요.

답변1

매뉴얼 에서 csvsimple:

{}값은 인용되지 않거나 TEX 그룹의 중괄호로 인용되어야 합니다 . 큰따옴표와 같은 다른 따옴표는 직접 지원되지 않지만 외부 도구를 사용하여 얻을 수 있습니다. 41페이지의 섹션 5.6을 참조하세요.

따라서 세 번째 셀의 내용을 묶는 {}대신 집합을 사용하면 효과가 있습니다." "

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

\documentclass{article}
\usepackage{csvsimple}
\usepackage{tabularx}
\begin{filecontents*}{tokens.csv}
method,corpus,tokens
MI,Quran,{allah, thou, thi, punish, believ, ye, thee, messeng, unbeliev, guid}
MI,OT,{allah, jesu, christ, thi, king, israel, believ, thou, lord, thee}
MI,NT,{jesu, christ, allah, ye, discipl, lord, thing, faith, israel, peter}
CHI²,Quran,{allah, punish, believ, messeng, unbeliev, guid, beli, disbeliev, vers, clear}
CHI²,OT,{allah, jesu, christ, thi, believ, king, israel, lord, thou, world}
CHI²,NT,{jesu, christ, discipl, ye, faith, thing, paul, peter, lord, allah}
\end{filecontents*}

\begin{document}
\csvautotabular{tokens.csv}

\bigskip

\csvreader[
  tabular=|l | l | p{7cm}|,
  table head= \hline method & corpus & tokens \\ \hline,
  late after last line=\\\hline,
]{tokens.csv}{}%
{\csvcoli & \csvcolii & \csvcoliii}

\bigskip

\begin{tabularx}{\linewidth}{|l|l|X|}
\hline
method & corpus & tokens \\
\hline
\csvreader[late after line=\\, late after last line =\\\hline]
  {tokens.csv}
  {}
  {\csvcoli & \csvcolii & \csvcoliii}
\end{tabularx}


\end{document}

관련 정보