I am using the csvsimple package to read a csv, and am doing some minimal formatting in Latex. The csv consists of strings formatted as percentages.
I have created hacks to get around most of the problems, but now have a % symbol off to the side of my table. Here is my code:
\documentclass[titlepage]{report}
\usepackage{graphicx}
\usepackage{csvsimple} % Generates table from .csv
\newcommand{\csvloopx}[2][]{\csvloop{#1,#2}}
\newcommand{\csvautotabularx}[2][]{\csvloopx[#1]{autotabular={#2}}}
\newcommand{\respectpercent}{\catcode`\%=12\relax}
\begin{document}
\begin{table}[H]
\begin{center}
\begingroup\catcode`"=9
\csvreader[no head, tabular=|c|r|r|r|r|,%
before table=\respectpercent,%
table head=\hline \multicolumn{1}{|p{2.5cm}|}{\centering \bfseries Year}%
& \multicolumn{1}{|p{2.5cm}|}{\centering \bfseries Base}%
& \multicolumn{1}{|p{2.5cm}|}{\centering \bfseries Round Lot \\ of 100 \\ Shares}%
& \multicolumn{1}{|p{2.5cm}|}{\centering \bfseries Transaction Cost \\ of \$0.01 \\ per~Share}%
& \multicolumn{1}{|p{2.5cm}|}{\centering \bfseries Transaction Cost \\ of \$0.01 \\ per Share and \\ Round Lot \\ of 100 Shares}\\\hline,%
late after line = \\\hline,%
filter expr={
test{\ifnumgreater{\thecsvinputline}{1}}}]%
{Figures/Document/Cost.csv}%
{1=\one, 2=\two, 3=\three, 4=\four, 5=\five}%
{$\one$ & $\two$ & $\three$ & $\four$ & $\five$}%
\endgroup
\end{center}
\caption{Market Cost Assumption}
\label{ tab:Slippage}
\end{table}
\end{document}
and the resulting table is
Any help is much appreciated. Thanks.
Here is the head of the csv file:
"Year","Base","RoundLot","TransactionCost","TransactionRoundLot"
2001,"3.41%","3.42%","3.35%","3.35%"
2002,"-10.46%","-10.45%","-10.50%","-10.49%"
2003,"22.58%","22.57%","22.53%","22.52%"
2004,"20.03%","20.02%","19.98%","19.97%"
H
option. Why? See here: tex.stackexchange.com/questions/370627/…