I've been trying to add eps graphics with the filename in a csv file. Take a look at the CSV to get an idea of what I mean: https://docs.google.com/spreadsheet/ccc?key=0Ao9if7HTdeaPdGowdXJXbURJQWVmVTdDUVRaYTdldXc#gid=0

So far, I've managed to get LaTeX to spit out this much:Table of Reagents

I'm trying to place figures (with compound eps and name) for each compound in the Reagent column. So far I've created a new column in Pgfplotstable and I'm trying to include values from the name and structure column of my csv file.

I'm pretty confused at this point, so I started trying to create a new command for every image which I would later call in the figure (\cmpi->compound 1 name, \structurei->compound 1 structure, \cmpii->compound 2 name, \structureii->compound 2 structure). I can't get that set up because the commands are lost after another call to defineCompound. There is probably a better way to create the in-table figures, but I am lost at this point.

The first \typeout{TESTING: \cmpi, \structurei} works and prints TESTING: (R)-(-)carvone, ../chemicals/(r)-(-)-carvone.eps, but the second fails due to "Undefined control sequence"


Any help at this point would be appreciated. I've just started using LaTeX and it's been a pretty rough journey so far.

I'm hoping to finally be able to have all of my compounds in one csv file and just be able to select which ones I would like based on which experiment I'm performing.

My LaTeX is:




    \global\expandafter\newcommand\csname cmp#1\endcsname{#2}
    \global\expandafter\newcommand\csname structure#1\endcsname{#3}
    \typeout{TESTING: \cmpi, \structurei}

\newcommand{\exptitle}{Conversion of Carvone to Carvacrol: Multiweek Experiment Part 1}

  \caption{Conversion of (R)-(-)Carvone to Carvacrol by Sulfuric Acid and Heat.}
  \caption{Balanced Equation.}
\section{Table of Reagents}
  \pgfplotstableread[col sep=comma]{../common/reagents.csv}\loadedtable
    create col/assign/.code={%
      \FPeval{\result}{clip(\pgfplotstablerow + 1)}
      \pgfkeyslet{/pgfplots/table/create col/next content}\entry
    string type,
    begin table=\begin{tabularx}{\textwidth},
    end table=\end{tabularx},
    %columns/name/.style={column name=Name, column type={|c}},
      column name=Reagent,
      column type={l},
      postproc cell content/.code={
        \message{\pgfkeysvalueof{/pgfplots/table/@cell content}}
        %\pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
    columns/mw/.style={column name={Molecular Weight (\si[per-mode=symbol]{\gram\per\mol})}, column type={X}},
    columns/bp/.style={column name=Boiling Point (\si{\celsius}), column type={l}},
    columns/mp/.style={column name=Melting Point (\si{\celsius}), column type={l}},
    columns/density/.style={column name=Density (g/mol), column type={X}},
    every nth row={1}{before row=\midrule},
    every head row/.style={before row=\toprule,after row=\midrule},
    every last row/.style={after row=\bottomrule},

  • Welcome at tex.sx. If you are doing first steps with LaTeX -- are you sure that this is good first use-case? It sounds to be highly advanced to me... – Christian Feuersänger Feb 12 '14 at 21:29
  • I'm pretty sure I've blown up a simple use to a really complex one. I'm going to try to simplify the problem so I can attack it a little easier. – James Kraus Feb 13 '14 at 22:16

I hope that I am answering the right question here... from what I understand you have a column of sorts "filename" and instead of just typesetting the file name, you want to include the associated graphics file by means of \includegraphics, right? If this assumption is wrong, I'd ask you to clean up your example and rephrase the question accordingly.

If my understanding is correct, then the following might prove helpful:

enter image description here


filename X
PP-figure0.pdf 1
PP-figure1.pdf 2
PP-figure2.pdf 3

      column name=Reagent,
      column type={l},
      assign cell content/.code={%
          \pgfkeyssetvalue{/pgfplots/table/@cell content}{\includegraphics{##1}}%


I have generated a small minimal example on my own. It uses assign cell content since this step is not a preprocessing step; it is the step as such.

It might benefit from some vertical alignment, but before I (or someone else) jumps onto it, you should clarify if this is what you wanted.

For the records: I generated the graphics files using pdflatex -shell-escape PP on the following file




\tikz \draw[left color=red, right color=white] (0,0) circle (10pt);
\tikz \draw[left color=blue, right color=white] (0,0) circle (10pt);
\tikz \draw[left color=black, right color=white] (0,0) circle (10pt);
  • Thanks for the reply! Include graphics works right up until I need to add the name of the compound below the graphic in the table. I can't figure out how to access the name of the compound and include the graphics in the same cell, which is why my example is getting overly complex. – James Kraus Feb 13 '14 at 22:08
  • Ah, I see. Could you modify your example such that it compiles out-of-the box (in particular, includes the table + its column names) with as few dependencies as possible? – Christian Feuersänger Feb 14 '14 at 9:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.