0

first my apologies for not providing a full minimum working example.

Description:

I have a large number of (mainly large) tables in the csv format that I wish to include in a LaTeX document.

The job itself is easily achieved with the csvsimple package, calling:

\usepackage{longtable}
\usepackage{csvsimple}

I include my tables using this command:

{
\small
\begingroup\catcode`"=9
    \csvautolongtable[respect underscore=true]{table_file.csv}
\endgroup
}

Problem:

Some of my tables are too wide to fit onto an A4 page, even in landscape mode. However, I have a number of columns that I do not need to include in the document. (They are nice to have, but not absolutely necessary.)

Question:

Can I exclude specific columns while retaining the use of the \cvsautotable command?

In case it helps, this is my header, consistent across the files. The columns I would want to drop are H to Br. Writing a custom header might work, but then I guess it needs a customization of the function to read in the table? (The header includes spaces as well...):

Name,dHf ref.(kJ/mol),DFT E0(Eh),DLPNO E0(Eh),ZPVE(J/mol),Htot(J/mol),H,C,N,O,F,Si,P,S,Cl,Br

(Yes, I saw the manual - and unfortunately I didn't extract a solution from it...)

Many thanks.

1

Thanks to a post from tex.stackexchange ( Importing CSV file as a table in Latex but file too long ), the following approach works:

Rather than excluding columns, only the desired columns are picked. Referring to columns by name would be difficult (due to use of the space character for example), so numbers can be used instead.

The "autotable" function is replaced with a manually defined layout, specifying a longtable and the header. Columns 1 to 6 are given a name and the name is used to specify the columns printed.

\csvreader[longtable=lr|rrrr,%
table head= Name & $\Delta Hf_{ref}$ (\si{kJ/mol}) & %
DFT $E_0$ (\si{E_h}) & DLPNO $E_0$ (\si{E_h}) & $ZPVE$ (\si{J/mol}) & $Htot$ (\si{J/mol}) \\ \hline\endhead,%
late after line=\\,%
,respect underscore=true]{csv_data_file.csv}
{1=\Name,2=\dHfref,3=\EzeroDFT,4=\EzeroDLPNO,5=\ZPVE,6=\Htot}%
{\Name & \dHfref & \EzeroDFT & \EzeroDLPNO & \ZPVE & \Htot}%

Not the most elegant solution, but it works.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.