我正在尝试使用LaTeX软件包csvsimple将CSV文件转换为LaTeX表。这是我的CSV文件:
Posizione,Fornitore,Nart,Quantità,Prezzounitario,Totriga
AAAA,BBBB,CCCC,1234,2121,1234
AAAA,BBBB,CCCC,1234,2121,1234
这是LaTeX表:
\begin{table}[h]
\centering
\begin{tabular}{lllrr|r}
\textbf{Posizione} & \textbf{Fornitore} & \textbf{N. art.} & \textbf{Quantità} & \textbf{Prezzo unit. (CHF)} & \textbf{Totale riga (CHF)} \\
\hline
\csvreader[head to column names]{table.csv}{}%
\end{tabular}
\end{table}
[当我尝试在OverLeaf中进行编译时,它没有错误,但是当我尝试使用PDFLaTeX进行编译(在MikTeX上,Win 10时,它不起作用。
这可能是错误的根源?谢谢你们。NC
编辑-MWE
根据要求,我提供MWE:
\documentclass{book}
\usepackage{graphicx}
\usepackage{parskip}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{url}
\usepackage{fontawesome}
\usepackage{lmodern}
\usepackage{csvsimple,makecell}
\makeatother
\begin{document}
\pagestyle{fancy}
\fancyfoot{}
\fancyhead{}
\fancyfoot[L]{{\footnotesize\textsf{\faAt \quad [email protected] \qquad \faInternetExplorer \quad \url{www.pcngroup.ch}}}}
\fancyfoot[R]{| \ \textsf{\textbf{\thepage}\ di \pageref{LastPage}}}
\renewcommand{\footrulewidth}{0.4pt}%
\begin{flushright}
%\includegraphics[scale=0.15]{pcn.png} \\[0.7cm]
John Doe \\ %UTENTE
[email protected] \\ %E-MAIL
\url{www.contoso.com}
\end{flushright}
\begin{flushleft}
Mario Rossi [1]\\Roupell St.\\ London , UK \\0987654321\\[email protected]
\end{flushleft}
\begin{center}
{\huge \textbf{PREVENTIVO}} \\[2cm]
\end{center}
\begin{flushright}
London, 11.5.2020
\\[1cm]
\end{flushright}
Egregio Sig. Rossi
Le trasmettiamo di seguito il preventivo come concordato. Restiamo a sua disposizione per eventuali chiarimenti o domande. Trova i nostri riferimenti nel più di pagina di questo documento.
La ringraziamo sin d'ora per la fiducia accordataci.
\paragraph*{Descrizione:} JNHGFDS
\begin{table}[h]
\centering
\begin{tabular}{lllrr|r}
\textbf{Posizione} & \textbf{Fornitore} & \textbf{N. art.} & \textbf{Quantità} & \textbf{Prezzo unit. (CHF)} & \textbf{Totale riga (CHF)} \\
\hline
\csvreader[head to column names]{table.csv}{}%
\end{tabular}
\end{table}
\paragraph{Validit\`a del preventivo:} 30 giorni.
\paragraph{Condizioni di pagamento:} Acconto all'ordinazione: 30 \%, saldo: 30 giorni.
\paragraph{Note al preventivo:}
GFRDS \\[0.5cm]
Distinti Saluti, \\[0.5cm]
\begin{flushright}
John Doe
\end{flushright}
\end{document}
\documentclass{book}
\usepackage{csvsimple}
\begin{filecontents*}[overwrite]{table.csv}
Posizione,Fornitore,Nart,Quantita,Prezzounitario,Totriga
AAAA,BBBB,CCCC,1234,2121,1234
AAAA,BBBB,CCCC,1234,2121,1234
\end{filecontents*}
%
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{lllrr|r}
\textbf{Posizione} & \textbf{Fornitore} & \textbf{N. art.} & \textbf{Quantità} & \textbf{Prezzo unit. (CHF)} & \textbf{Totale riga (CHF)} \\
\hline
\csvreader[head to column names]{table.csv}{}%
{\Posizione & \Fornitore & \Nart & \Quantita & \Prezzounitario & \Totriga\\}\\
\end{tabular}
\end{table}
\end{document}