Embedding other external tools into a TeX frame: Difference between revisions

From Scribus Wiki
Jump to navigation Jump to search
 
(3 intermediate revisions by one other user not shown)
Line 121: Line 121:


|[[Image: ScGnuplot.png]]
|[[Image: ScGnuplot.png]]
|}
==LilyPond==
{|
| bgcolor="lightgrey" |
'''Command:''' lilypond %file
'''Output File Extension:''' .pdf
|}
{|
| valign="top" | LilyPond is a program for creating musical notation. The image shows the output of the first and very simple example from the LilyPond documentation:
<pre>
{
  c' e' g' e'
}
</pre>
|[[Image: Lylipond.png]]


|}
|}
Line 129: Line 154:


* [http://pcal.sourceforge.net/ PCal] (even if Scribus already has a very nice script for generating calendars)
* [http://pcal.sourceforge.net/ PCal] (even if Scribus already has a very nice script for generating calendars)
* [http://lilypond.org/web/ LilyPond] for musical notation
* [http://icking-music-archive.org/software/indexmt6.html MusixTeX] for musical notation
* [http://icking-music-archive.org/software/indexmt6.html MusixTeX] for musical notation
* [http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=skak Skak] for typesetting chess games
* [http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=skak Skak] for typesetting chess games

Latest revision as of 20:46, 3 October 2007

Introduction

Since version 1.3.5, Scribus knows the frame type "TeX". Frames of this type are normally used to integrate a LateX document into Scribus. But with this function, it is possible to integrate the output of any external program into Scribus. Some prerequisites are necessary:

  • The external program should be a commandline program. It has to take an input file as argument and produces an output file.
  • The output has to be in a format, which is readable by a Scribus image frame. For example, PDF, SVG, JPG, and a lot of other bitmap formats are possible.

To configure Scribus to use an arbitrary external program as input for the TeX frames, open "File / Preferences" and edit the settings for "External Tools". Here, you find the entry "LateX":

  • Delete the text in "Preamble" and "End".
  • Change the command in "Name of Executable" to your needs:
    • Here, you can use the variables "%file" which stands for the input and "%file.pdf" which represents the output file. If your file is not in PDF format and you specify in "Output file extension" an other extension, then use use that extension instead of PDF in the output variable. For example, a PNG file format is refered as "%file.png".
    • Activate the option "Start with empty frame" and delete the content of "Preamble" and "End".
    • You can still use the embedded editor, even for non-LateX code, or an external one, just as you like.


ExternalToolsPreferences.png


Here are some examples, how external programs can be embedded into Scribus:

XSL FO with Apache FOP

Command: fop -fo %file -pdf %file.pdf

Output File Extension: .pdf

XSL FO, "The XSL Formatting Objects", is a markup language which can be used to automatically layout XML-data. With the help of a "Formatting Objects Processor", for example the Apache FOP, these XML code is rendered into PostScript, PDF or another format.

The command above shows how you can integrate Apache FOP's output directly into Scribus, using the PDF format which is created by Apache FOP. If you have XML code which still needs to be transformed with an XSL script, just add "-xsl /path/to/xsl.xsl" to the executable command.

Some more complex examples for XSL FO can be found in the st-scripts

ScFOP.png

Graphs with GraphWiz

Command: dot -Tps %file -o %file.ps

Output File Extension: .ps

GraphViz is an application for drawing graphs, trees and similiar representations of hierarchical structured data. Beside the here used PostScript output, GraphViz is also able to produce GIF, PNG and some more formats which Scribus can't read. Using the PostScript output should work fine.

The code for the example:

digraph unix {
	size="6,6";
	edge [color ="blue"];
	"S" [color="#f94949", style=filled];
	node [shape="box", color="#6767ed", style=filled];
	"S" -> "NP";
	"S" -> "VP";	
	"NP" -> "DET";
	"NP" -> "NOUN";	
	"VP" -> "VERB";
	node [shape="box", color="#82ec80", style=filled]
	"DET" -> "Der";
	"NOUN" -> "Hund";
	"VERB" -> "bellt";
}
ScGraphWiz.png


MathML Formulas with JEuclid

Command: /opt/jeuclid/jeuclid-3.0.1/bin/mml2xxx %file %file.png

Output File Extension: .png

JEuclid is an application which renders MathML or OpenOffice formulas into PNG, PDF, SVG and some more formats. Even as the script mml2xxx was in my path, I wasn't able to execute the script from somewhere else than from it's original position, so I had to use the full path to mml2xxx here. ScJEuclid.png

Gnuplot

Command: gnuplot %file

Output File Extension: .png

Gnuplot is a mighty application for drawing diagrams. Gnuplot works a little bit different than the other programs, so you have to write the following two lines above your functions:
set terminal png
set output "$scribus_file$.png"

After that, you can add your functions or data imports:

plot sin(x)
ScGnuplot.png


LilyPond

Command: lilypond %file

Output File Extension: .pdf

LilyPond is a program for creating musical notation. The image shows the output of the first and very simple example from the LilyPond documentation:
{
  c' e' g' e'
}


Lylipond.png

ToDo

There are a lot more programs which can be used in this way from inside Scribus. Some examples to try are:

  • PCal (even if Scribus already has a very nice script for generating calendars)
  • MusixTeX for musical notation
  • Skak for typesetting chess games