gnuplotghostscript

Gnuplot / Ghostscript create a table of content


I'm developing a Java application that processes information and that info has to be saved as graphs in a PDF file. I have 60 graphs as output, all with a different title.

What is an easy way to make a table of contents from all the graphs based on their title? Is there a command that can do this? Or do I have to use pdfmarks?

I can't find anything about this on the internet because if I use the words table of contents, I just get the table of contents of gnuplot/ghostscript itself.


Solution

  • You can generate the PDF using Latex and then use the epslatex terminal in gnuplot to generate the figures. You can write a script which generates the Latex document.

    The gnuplot script:

    set term epslatex color size 3,2 font 6
    set output "figure1.eps"
    #
    set title 'Title of figure1'
    #
    plot sin(x)
    #
    exit
    

    This generates an EPS file named figure1.eps and a Latex file named figure1.tex which embeds the EPS.

    The the following Latex can in turn embed figure1.tex into a document:

    \documentclass{article}
    
    \usepackage{graphicx}
    \usepackage{color}
    \usepackage{amsmath}
    \usepackage{amsfonts}
    \usepackage[mathcal]{euscript}
    
    \begin{document}
    
    \listoffigures
    
    \begin{figure}
    \centering
    \include{figure1}
    \caption[Description of figure1 as it appears on the list of
    figures]{Caption of figure1.}
    \end{figure}
    
    \end{document}
    

    Using the \listoffigures command a list of figures will be generated. You might need to run Latex a couple of times before the table appears. Then use dvipdf to export to PDF. The result should look like this:

    enter image description here