I have searched for a long time on the internet (here and other LaTeX resources on the web) but I could not find the answer to my (simple) question: how could I draw a table with Pgfplots, with data input from csv file containing special characters such as "µ" in the column header (to display units of time or distance for intance)?

I found many questions with topics related to this one, but nothing reponsding exactly to my need.

Here is an example of the table within which I would like to have a lovely "µS" instead of "uS"...

enter image description here

As an example, here is how my csv file is populated:

No. ;Peak Name ;Precision RSD Height uS;Precision RSD Area uS*min;Precision RSD Ret.Time min
1  ;Glyoxylate;6.65;3.86;1.51
2  ;Pyruvate;1.32;0.68;1.19

I naively thought I could make pgfplots take all content of column header as string text, but even with the "string type" option, I get errors when compiling...

I will be very grateful to anyone who could help me.

EDIT: I still could not solve my problem; here is an example of my code (for the example, the data is provided as "filecontents" instead of csv).

1_1 MTU (µS);2_2 GRA (µmol);3_3 LBU

\pgfplotsset{trig format plots=rad, compat=1.11}


\pgfplotstabletypeset [
    col sep=semicolon,
    header=has colnames,
    column type/.add={|}{},
    every head row/.style={
        before row={\hline}},
    after row=\hline,
    display columns/0/.style={string type, column type=|c},
    display columns/1/.style={string type, column type=|c},
    display columns/2/.style={string type, column type=|c|},
    every last row=\hline

  • 1
    An MWE would be helpful, but it may be easiest to just use siunitx to format the column headers in the document instead of the CSV. See the manual pages 3-4 and similar for examples (without siunitx). – Mike Renfro Dec 8 '14 at 22:57
  • Thank you Mike for the hint; the problem is that formatting the columns in the tex file is not the appropriate option for my case. The content of columns and values varies from one table to another: I have the same "mechanism" of tables that I re-use for multiple table contents within my document; the head rows embed columns titles (including units of various types that may be present but not systematically). This is why I was trying to make the special character µ simply "uninterpreted" and taken as a simple text element. – Sebastien Dec 9 '14 at 0:25
  • Related, assuming you can write Unicode to the CSV file: using special characters in csv file imported by pgfplotstable. Then again, depending on how much control you have over the CSV, you might be able to write a TeX formatted header there, assuming pgfplotstable supports that. – Mike Renfro Dec 9 '14 at 0:50

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.