3

I'm trying to create new colMix column as two combined-columns from CSV file. Each of them may contain some (standard) LaTeX formating (included inside the CSV file). There is MWE (non-working):

\documentclass{article}
\usepackage{pgfplotstable, filecontents}

\begin{document}
\begin{filecontents*}{data.csv}
colA; colB
A;    B
AA;   \emph{BB}
\end{filecontents*}

\pgfplotstableset{
    col sep=semicolon,
    string type,
    header=has colnames,    
    create on use/colMix/.style={
        create col/assign/.code={
            \edef\entry{\thisrow{colA}+\thisrow{colB}}
            \pgfkeyslet{/pgfplots/table/create col/next content}\entry
        }
    },
    columns={colA, colB, colMix},
}
\pgfplotstabletypeset{data.csv} 
\end{document}

How to correctly define new colMix column to respect LaTeX formating?

  • Maybe you can make use of \def\emph{\noexpand\emph}. – Symbol 1 Aug 7 '17 at 21:14
  • Can you get rid of your "(standard) LaTeX formatings"? If yes, you could simply use something like string replace={BB}{\emph{BB}} – cis Nov 10 '18 at 9:30

Your Answer

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

Browse other questions tagged or ask your own question.