Difference between revisions of "ExecutableLatexTutorial"

From VistrailsWiki
Jump to navigation Jump to search
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
This tutorial shows how to edit an executable paper using VisTrails and its LaTeX extensions.  It requires [http://www.latex-project.org LaTeX] and [[Downloads VisTrails]] (version 1.6.2 or later).  Please download them if you have not done so already.
This tutorial shows how to edit an executable paper using VisTrails and its LaTeX extensions.  It requires [http://www.latex-project.org LaTeX] and [[Downloads | VisTrails]] (version 1.6.2 or later).  Please download them if you have not done so already.


# The tutorial uses this paper [TODO add link].  Please download the source here [TODO add link].
# The tutorial will involve this [http://www.vistrails.org/download/download.php?type=OTHER&id=latex-tutorial.pdf paper].  Please download the source [http://www.vistrails.org/download/download.php?type=OTHER&id=latex-tutorial.zip here].
# After downloading and extracting the source directory, compile the paper.  If you have <code>make</code> installed, you can use the included Makefile.  If not, type<br/><pre>pdflatex --shell-escape tutorial</pre>Make sure that <code>vistrails.sty</code> and <code>includevistrail.py</code> are included in the same directory as the paper.
# After downloading and extracting the source directory, compile the paper.  If you have <code>make</code> installed, you can use the included Makefile.  If not, type<br/><pre>pdflatex --shell-escape tutorial</pre>Make sure that <code>vistrails.sty</code> and <code>includevistrail.py</code> are included in the same directory as the paper.
# Open the newly created <code>tutorial.pdf</code>.  You should see the generated figure.
# Open the newly created <code>tutorial.pdf</code>.  You should see the generated figure.
# Click on the figure.  This should download a <code>.vtl</code> file from the [http://alps.comp-phys.org/ ALPS server].  If this file does not open automatically with VisTrails, double-click it and define the file extension association or open it directly in VisTrails via '''File -> Open'''.
# Click on the figure.  This should download a <code>.vtl</code> file from the [http://alps.comp-phys.org/ ALPS server].  If this file does not open automatically with VisTrails, double-click it and define the file extension association or open it directly in VisTrails via '''File -> Open'''.
# The VisTrails Spreadsheet should display the same figure.  You can pan and zoom the plot as you would with [http://matplotlib.sourceforge.net/ matplotlib].
# [[File:Latex_spreadsheet_1.png|thumb|300px|VisTrails Spreadsheet]] The VisTrails Spreadsheet should display the same figure.  You can pan and zoom the plot as you would with [http://matplotlib.sourceforge.net/ matplotlib]. <br style="clear: both" />
# If the "Builder Window" is not shown, display it using '''Window -> Show Builder Window'''.
# [[File:Latex_builder.png|thumb|300px|VisTrails Builder Window]] If the "Builder Window" is not shown, display it using '''Window -> Show Builder Window'''. <br style="clear: both" />
# Switch to the"Pipeline" view.  Click the corresponding button in the toolbar at the top of the builder window.
# Switch to the"Pipeline" view.  Click the corresponding button in the toolbar at the top of the builder window.
# Select the module titled "a" (it is displayed as a box with ports that connect to other modules)
# [[File:Latex_pipeline.png|thumb|300px|Editing the computation]] Select the module titled "a" (it is displayed as a box with ports that connect to other modules). <br style="clear: both" />
# In the "Set Methods" panel on the right, change the "value" parameter from <code>1.0</code> to <code>1.4</code> and click the '''Execute''' button.  VisTrails will create a new plot that shows divergence of the individual lines.
# [[File:Latex_spreadsheet_2.png|thumb|300px|New figure in spreadsheet]] In the "Set Methods" panel on the right, change the "value" parameter from <code>1.0</code> to <code>1.4</code> and click the '''Execute''' button.  VisTrails will create a new plot that shows divergence of the individual lines.<br style="clear: both" />
# Save the vistrail in the same directory as the LaTeX source.  Choose '''File -> Save As...''' and find the source directory, naming the file "alps.vt"
# Save the vistrail in the same directory as the LaTeX source.  Choose '''File -> Save As...''' and find the source directory, naming the file "alps.vt".
# Switch to the "History" view.
# Switch to the "History" view.
# Click the '''Embed''' button in the lower-right corner.  This will bring up an assistant that will generate new LaTeX code that can be copied back to the LaTeX source.  '''Note:''' If you have not saved the file, you will see a message asking you to save your vistrail before proceeding.
# [[File:Latex_embed.png|thumb|150px|Embedding the result]] Click the '''Embed''' button in the lower-right corner.  This will bring up an assistant that will generate new LaTeX code that can be copied back to the LaTeX source.  '''Note:''' If you have not saved the file, you will see a message asking you to save your vistrail before proceeding. <br style="clear: both" />
# Make sure "Workflow Results" and "Latex" are selected in the top drop-down menus.  Check the "As PDF", "Cache Images", and "Include Workflow" options, and click '''Copy to Clipboard'''.
# Make sure "Workflow Results" and "Latex" are selected in the top drop-down menus.  Check the "As PDF", "Cache Images", and "Include Workflow" options, and click '''Copy to Clipboard'''.
# Open the <code>tutorial.tex</code> in your favorite text editor.
# Open the <code>tutorial.tex</code> in your favorite text editor.
# Find the <code>\begin{figure}</code> section and replace the text between the "Begin edit area" and "End edit area" comments with the text from the clipboard.
# Find the <code>\begin{figure}</code> section and replace the text between the "Begin edit area" and "End edit area" comments with the text from the clipboard. The new code should look similar to the following:<pre>\vistrail[filename=alps.vt, version=2, pdf, embedworkflow]{}</pre>
# Note that you will probably wish to size the figure correctly so add the width inside the braces.  For example,<br><pre>\vistrail[...]{width=0.45\textwidth}</pre>
# Note that you will probably wish to size the figure correctly so add the width inside the braces.  For example,<br><pre>\vistrail[filename=alps.vt, version=2, pdf, embedworkflow]{width=0.45\textwidth}</pre>
# Edit the <code>\renewcommand{\vistrailspath}{...}</code> line to point to your VisTrails install.  Note that for Mac OS X, you need to provide the path to the executable inside the application bundle.  For example,<br><pre>renewcommand{\vistrailspath}{/Applications/VisTrails.app/Contents/MacOS/vistrails}</pre>
# Edit the <code>\renewcommand{\vistrailspath}{...}</code> line to point to your VisTrails install.  Note that for Mac OS X, you need to provide the path to the executable inside the application bundle.  For example,<br><pre>renewcommand{\vistrailspath}{/Applications/VisTrails.app/Contents/MacOS/vistrails}</pre>
# Save the modified file.
# Save the modified file.
# Quit VisTrails.
# Quit VisTrails.
# Recompile the LaTeX source.  Again, you may use the included Makefile or call <code>pdflatex</code> directly.  LaTeX will call VisTrails to generate the new figure and include it in the new paper.
# Recompile the LaTeX source.  Again, you may use the included Makefile or call <code>pdflatex</code> directly.  LaTeX will call VisTrails to generate the new figure and include it in the new paper.
# You should see a new version of the paper with the modified results included.  If you run into an error, make sure you have quit VisTrails before running the command and that you have redefined <code>\vistrailspath</code> to point to your local copy of VisTrails.
# You should see a new version of the paper with the modified results included.  It should look something like [http://www.vistrails.org/download/download.php?type=OTHER&id=latex-tutorial-after.pdf this].  If you run into an error, make sure you have quit VisTrails before running the command and that you have redefined <code>\vistrailspath</code> to point to your local copy of VisTrails.  Also, make sure that you have saved the <code>.vt</code> file (from Step 10) to the same directory as the <code>tutorial.tex</code> file.

Latest revision as of 23:34, 20 May 2011

This tutorial shows how to edit an executable paper using VisTrails and its LaTeX extensions. It requires LaTeX and VisTrails (version 1.6.2 or later). Please download them if you have not done so already.

  1. The tutorial will involve this paper. Please download the source here.
  2. After downloading and extracting the source directory, compile the paper. If you have make installed, you can use the included Makefile. If not, type
    pdflatex --shell-escape tutorial
    Make sure that vistrails.sty and includevistrail.py are included in the same directory as the paper.
  3. Open the newly created tutorial.pdf. You should see the generated figure.
  4. Click on the figure. This should download a .vtl file from the ALPS server. If this file does not open automatically with VisTrails, double-click it and define the file extension association or open it directly in VisTrails via File -> Open.
  5. VisTrails Spreadsheet
    The VisTrails Spreadsheet should display the same figure. You can pan and zoom the plot as you would with matplotlib.
  6. VisTrails Builder Window
    If the "Builder Window" is not shown, display it using Window -> Show Builder Window.
  7. Switch to the"Pipeline" view. Click the corresponding button in the toolbar at the top of the builder window.
  8. Editing the computation
    Select the module titled "a" (it is displayed as a box with ports that connect to other modules).
  9. New figure in spreadsheet
    In the "Set Methods" panel on the right, change the "value" parameter from 1.0 to 1.4 and click the Execute button. VisTrails will create a new plot that shows divergence of the individual lines.
  10. Save the vistrail in the same directory as the LaTeX source. Choose File -> Save As... and find the source directory, naming the file "alps.vt".
  11. Switch to the "History" view.
  12. Embedding the result
    Click the Embed button in the lower-right corner. This will bring up an assistant that will generate new LaTeX code that can be copied back to the LaTeX source. Note: If you have not saved the file, you will see a message asking you to save your vistrail before proceeding.
  13. Make sure "Workflow Results" and "Latex" are selected in the top drop-down menus. Check the "As PDF", "Cache Images", and "Include Workflow" options, and click Copy to Clipboard.
  14. Open the tutorial.tex in your favorite text editor.
  15. Find the \begin{figure} section and replace the text between the "Begin edit area" and "End edit area" comments with the text from the clipboard. The new code should look similar to the following:
    \vistrail[filename=alps.vt, version=2, pdf, embedworkflow]{}
  16. Note that you will probably wish to size the figure correctly so add the width inside the braces. For example,
    \vistrail[filename=alps.vt, version=2, pdf, embedworkflow]{width=0.45\textwidth}
  17. Edit the \renewcommand{\vistrailspath}{...} line to point to your VisTrails install. Note that for Mac OS X, you need to provide the path to the executable inside the application bundle. For example,
    renewcommand{\vistrailspath}{/Applications/VisTrails.app/Contents/MacOS/vistrails}
  18. Save the modified file.
  19. Quit VisTrails.
  20. Recompile the LaTeX source. Again, you may use the included Makefile or call pdflatex directly. LaTeX will call VisTrails to generate the new figure and include it in the new paper.
  21. You should see a new version of the paper with the modified results included. It should look something like this. If you run into an error, make sure you have quit VisTrails before running the command and that you have redefined \vistrailspath to point to your local copy of VisTrails. Also, make sure that you have saved the .vt file (from Step 10) to the same directory as the tutorial.tex file.