~ubuntu-branches/debian/sid/pyx/sid

« back to all changes in this revision

Viewing changes to examples/text/color.txt

  • Committer: Bazaar Package Importer
  • Author(s): Stuart Prescott
  • Date: 2011-05-20 00:13:52 UTC
  • mto: (9.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20110520001352-odcuqpdezuusbbw1
Tags: upstream-0.11.1
ImportĀ upstreamĀ versionĀ 0.11.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Using the same color in PyX and in LaTeX
 
2
 
 
3
! This example shows three different methods how to use a color defined in PyX
 
4
also in LaTeX.... In the example code, we first define a cmyk color `col`,
 
5
which is then used to define a color `COL` in LaTeX. The latter is then used in
 
6
a LaTeX expression.
 
7
 
 
8
! The same behavior can be achieved by two different methods in `c.text`,
 
9
 
 
10
    r"\textcolor[named]{PineGreen}{Text} and outline ..."
 
11
    r"\textcolor[pyx]{color.cmyk.PineGreen}{Text} and outline ..."
 
12
 
 
13
They are not as elegant as the above shown, since we need to insert the color
 
14
definition `PineGreen` explicitly. The first alternative makes use of the
 
15
`named` color model of color.sty. All colors of this model are predefined also
 
16
in PyX. The other alternative allows to use PyX colors directly.
 
17
 
 
18
!! Note that no graphics driver has been used for the color.sty LaTeX package.
 
19
PyX performs a hack to enforce the use of its own LaTeX driver file pyx.def. In
 
20
case that you have installed the three files `pyx.def`, `color.cfg`, and
 
21
`graphics.cfg` from the PyX distribution somewhere in the LaTeX search path, it is
 
22
possible to use
 
23
 
 
24
    text.set(mode="latex", pyxgraphics=0)
 
25
    text.preamble(r"\usepackage[pyx]{color}")
 
26
 
 
27
which is the more aesthetic variant.