0

I'm using csvsimple to turn a CSV file into a table. I would like to embed the content of the CSV file into the LaTeX source file itself. Is this possible?

\documentclass{article}
\usepackage{csvsimple}
\begin{document}
\csvautotabular{csv.csv}
\end{document}

where csv.csv contains, for example,

1,2,3
4,5,6

I'm thinking about doing something like:

\documentclass{article}
\usepackage{csvsimple}
\begin{document}
\csvautotabular{
1,2,3
4,5,6
}
\end{document}
1

1 Answer 1

1

According to Thomas F. Sturm's comment:

\documentclass{article}
\usepackage{csvsimple}
\usepackage{filecontents}
\begin{document}
\begin{filecontents*}{csv.csv}
1,2,3
4,5,6
\end{filecontents*}
\csvautotabular{csv.csv}
\end{document}
  • \usepackage{filecontents} is needed to be able to declare the filecontents environment outside of the preamble.
  • The starred filecontents* is needed to disregard the return character after \begin{filecontents*}{csv.csv}.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .