I have the following CSV dow_distribution.csv
file:
dow,ANZ Volume,BHP Volume,CBA Volume,MQG Volume,NAB Volume,QAN Volume,RHC Volume,TLS Volume,WBC Volume,WOW Volume,AORD Volume,Total Volume
Monday,3.63,6.64,1.93,0.88,3.14,5.77,0.23,19.89,3.56,1.57,457.56,504.81
Tuesday,4.11,7.74,2.12,0.92,3.64,7.04,0.25,22.3,4.07,1.8,520.05,574.05
Wednesday,4.36,8.14,2.26,1.02,3.86,7.58,0.26,23.82,4.3,1.91,543.45,600.96
Thursday,4.56,8.32,2.46,1.07,4.22,7.3,0.25,24.05,4.44,2.05,547.04,605.76
Friday,2.47,4.61,1.36,0.63,2.22,3.76,0.13,13.38,2.33,1.02,292.65,324.58
Saturday,,,,,,,,,,,,0
Sunday,1.58,2.88,0.86,0.35,1.4,2.46,0.09,8.91,1.56,0.76,194.2,215.06
I want to process this into a table that fits onto the width of my page.
I've tried below – and have been reading the csvsimple package to rectify it but having difficulty doing so.
\documentclass[a4paper,14]{report}
\usepackage[utf8]{inputenc} % Commented out due to Cautionary error.
\usepackage{csvsimple}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
}
\begin{document}
\csvautotabular{dow_distribution.csv}
\end{document}
Desired Output:
Perhaps having a line break between the ticket names and the "Volume" might help shorten the width of the table (did it with MS paint), :
Best Answer
The
\csvautotabular
macro is just for quick visualization. It it not intended to be used for productive code. Here,\csvreader
or\csvloop
allow customization.I have two suggestions for your table.
The first one sets the table columns to a fixed width of
9mm
which results in breaking the title automatically.The second one rotates the long title texts by 90 degrees with help of the
graphicx
package and a small auxiliary macro\myrot
.This gives: