I edited the question and added a MWE. Please feel free to change tags or the title of the topic since I'm not sure how to categorize my problem.
I'm using the tabu package and pgfplotstable for automated csv-output.
The csv-file is called testfile.dat and has this content
Header
1,2
3,4
5,6
The first table in the MWE automatically reads the file and creates a table output. The second table in the MWE shows the table I WANT to be created.
I now have the following issues:
- Sometimes, an column-index row is printed, the command
header=false
makes no difference here - I want the pgfmarks - as shown in the second table - to be created dynamically using an integer counter. As suggested at this topic. However, it is not possible for me to add the required counter-increment and output at the correct place in each row without creating
misplaced noalign
errors (the issue can be recreated by using the second row which is currently commented in the MWE).
In the MWE below, two tables can be seen. First ist a working automated output (note the rows starting with \noalign
and \stepcounter
for the abovementioned problem).
The second table shows an output I imagine should be feasible. Please note that the command \stepcounter
is not provided simply because I can't find any way to add id correctly to the table rows.
MWE:
\documentclass[english,listof=totoc]{scrartcl}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{float}
\usepackage{tabu}
\usepackage{pgfplotstable} %package for automated csv-table-creation
\usepackage{pgfplots} %see above
\usepackage{colortbl} %allows coloring in tables
\definecolor{lightergray}{RGB}{242,242,242} % define a color for later use
\usepackage{hhline} %% Alternative horizontal line for tables
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
First the automatically created table:
\newcounter{mycounter}
\pgfplotstabletypeset[
debug=true,
col sep = comma,
%row sep = newline, %% This does not change anything
skip coltypes=true,
begin table={\tikzmark{tabstartmaindim}%
\begin{tabu} to \textwidth {|>{\columncolor{lightergray}}X|X|} \hhline{--} },
end table={\end{tabu}\tikzmark{tabendmaindim}},
skip first n=1,
columns={[index]0,[index]1},
%header=false,
every col no 0/.style={string type},
every col no 1/.style={string type},
every head row/.append style={
before row={%
\multicolumn{2}{|l|}{\cellcolor{lightergray}\textbf{Custom Title}} \\%
\hhline{--}
},
after row={%
\noalign{\pgfmark{testmark}}\hhline{--}
% \stepcounter{mycounter}\noalign{\pgfmark{testmark}}\hhline{--}
},
},
every nth row = {1}{ before row =\noalign{\pgfmark{a4}}\hhline{--}},
every last row/.style ={ after row ={\hhline{--} \tabuphantomline}}
]
{testfile.dat}
This is the table I want to create:
\tikzmark {tabstartnew}%
\begin {tabu} to \textwidth {|>{\columncolor {lightergray}}X|X|} \hhline{--}
\multicolumn {2}{|l|}{\cellcolor {lightergray}\textbf {Custom Title}} \\\hhline{--}
%0&1\\\hhline{--} %% Note: I don't really understand why this line is created, the option "header=false" does not change anything.
1&2 \\\noalign{\pgfmark{testmark1}}\hhline{--}
3&4 \\\noalign{\pgfmark{testmark2}}\hhline{--}
5&6 \\\noalign{\pgfmark{testmark3}}\hhline{--}
\tabuphantomline %
\end {tabu}%
\tikzmark {tabendnew}%
\end{document}
After thinking about my question, I guess my rephrased problem is:
Table created by pgfplotstable from .csv-data. Each row should have a counter and a dynamically-named pgfmark (or tikzmark) which does not add to the rows height.