make all parts of the manual compile again; parts of the manual are still out of...
[PyX/mjg.git] / faq / pyxfaq.tex
bloba2f782e6e15461d8554599fab8e31f82310db5e2
1 \documentclass[11pt,DIV14]{scrartcl}
2 \usepackage[latin1]{inputenc}
3 \usepackage{url}
4 \usepackage{mathptmx}
5 \usepackage[all,comments]{glifaq}
6 %\usepackage[answered]{glifaq}
7 \usepackage[pdftex]{hyperref}
8 \hypersetup{pdftitle={PyX FAQ}%
9 ,pdfauthor={\textcopyright\ Gert-Ludwig Ingold
10 <gert.ingold@physik.uni-augsburg.de>}%
11 ,colorlinks=true%
12 ,linkcolor=blue}
13 \begin{document}
14 \begin{center}
15 \LARGE\sffamily Some frequently and\\
16 not so frequently asked questions\\
17 about \PyX\\
18 \par
19 {\small\sffamily (\today)}\\[1truecm]
20 \large
21 Gert-Ludwig Ingold \par
22 \href{mailto:gert.ingold@physik.uni-augsburg.de}{\url{<gert.ingold@physik.uni-augsburg.de>}}
23 \end{center}
24 \toc
25 \newpage
27 \section{General aspects of \PyX}
28 \question{a}{Where do I get the latest version of \PyX?}
30 {The current release of \PyX{} (as well as older ones) is freely available
31 from \url{http://pyx.sourceforge.net} where also a CVS repository with the
32 latest patches can be found. Possibly older versions of \PyX{} are
33 also available as package for
34 various Linux distributions: see, for instance,
35 \url{http://packages.debian.org/testing/python/python-pyx.html} for
36 information on the \PyX{} package in Debian GNU/Linux,
37 \url{http://packages.gentoo.org/ebuilds/?pyx-0.3.1} for a Gentoo Linux
38 ebuild, and
39 \url{http://www.suse.de/en/private/products/suse_linux/i386/packages_professional/python-pyx.html}
40 for the \PyX{} package in the SUSE LINUX professional distribution.
43 \question{c}{How can I determine the version of \PyX{} running on my
44 machine?}
46 {Start a python session (usually by typing \texttt{python} at the system
47 prompt) and then type the following two commands (\texttt{>>>} is the python
48 prompt)
49 \begin{progcode}
50 >>> import pyx\\
51 >>> pyx.\us\us{}version\us\us
52 \end{progcode}
55 \question{c}{Does \PyX{} run under my favorite operating system?}
57 {Yes, if you have installed Python (\uaref{q:what_is_python})
58 and \TeX{} (\uaref{q:what_is_tex}). Both are available for
59 a large variety of operating systems so chances are pretty good that you will
60 get \PyX{} to work on your system.
63 \question{c}{Under which versions of Python will \PyX{} run?}
65 {\PyX{} will definitely run under Python 2.2 and higher and it is supposed
66 to work under Python 2.1. Your are likely to encounter problems with Python 2.0
67 and with Python 1.x \PyX{} will not work. The version of your Python interpreter
68 can be determined by calling it with the option \texttt{-V}. Alternatively,
69 you can simply start the interpreter and take a look at the startup message.
70 Note that there may be different versions of Python installed on your system
71 at the same time.
74 \question{a}{Where can I get help if my question is not answered in this FAQ?}
76 {The \PyX{} sources contain a reference manual and a set of examples
77 demonstrating various features of \PyX. If the feature you are looking for is
78 among them, using the appropriate part of the example code or adapting it for
79 your purposes may help.
81 There is also a user discussion list about \PyX{} which you can subscribe to
82 at \url{http://lists.sourceforge.net/lists/listinfo/pyx-user}. The archive of
83 the discussion list is available at \url{http://sourceforge.net/mailarchive/forum.php?forum_id=23700}.
86 \section{Python}
88 \question{c}{What is Python?}
90 {\label{q:what_is_python}
91 From \url{www.python.org}:
92 \begin{quote}
93 Python is an \textit{interpreted, interactive, object-oriented} programming
94 language. It is often compared to Tcl, Perl, Scheme or Java.
96 Python combines remarkable power with very clear syntax. It has modules,
97 classes, exceptions, very high level dynamic data types, and dynamic typing.
98 There are interfaces to many system calls and libraries, as well as to various
99 windowing systems (X11, Motif, Tk, Mac, MFC). New built-in modules are easily
100 written in C or C++. Python is also usable as an extension language for
101 applications that need a programmable interface.
103 The Python implementation is portable: it runs on many brands of UNIX, on
104 Windows, OS/2, Mac, Amiga, and many other platforms. If your favorite system
105 isn't listed here, it may still be supported, if there's a C compiler for it.
106 Ask around on \href{news:comp.lang.python}{news:comp.lang.python} --- or just
107 try compiling Python yourself.
109 The Python implementation is
110 \href{http://www.python.org/doc/Copyright.html}{copyrighted}
111 but \textbf{freely usable and distributable, even for commercial use}.
112 \end{quote}
115 \question{a}{Where can I learn more about Python?}
117 {The place to start is \url{www.python.org} where you will find plenty of
118 information on Python including tutorials.
121 \question{c}{What do I need to import in order to use \PyX?}
123 {It is recommended to begin your Python code with
124 \begin{progcode}
125 from pyx import *
126 \end{progcode}
127 when using \PyX. This allows you for example to write simply
128 \texttt{graph.graphxy}
129 instead of \texttt{pyx.graph.graphxy}. The following modules will be loaded:
130 \texttt{box}, \texttt{canvas}, \texttt{color}, \texttt{connector}, \texttt{data},
131 \texttt{deco}, \texttt{epsfile}, \texttt{graph}, \texttt{path},
132 \texttt{style}, \texttt{trafo}, \texttt{tex}, \texttt{text}, and
133 \texttt{unit}.
135 For convenience, you might import specific objects of a module like in
136 \begin{progcode}
137 from graph import graphxy
138 \end{progcode}
139 which allows you to write \texttt{graphxy()} instead of \texttt{graph.graphxy()}.
141 All code segments in this document assume that the import line mentioned in
142 the first code snippet is present.
145 \question{a}{What is a raw string and why should I know about it when
146 using \PyX?}
148 {\label{q:raw_string}
149 The backslash serves in standard Python strings to start an escape sequence.
150 For example {\cs n} corresponds to a newline character. On the other hand,
151 \TeX{} and \LaTeX{}, which do the typesetting in \PyX, use the backslash to
152 indicate the start of a command. In order to avoid the standard interpretation,
153 the string should be marked as a raw string by prepending it by an \texttt{r}
154 like in
155 \begin{progcode}
156 c.text(0, 0, r"\${\cs alpha}{\cs beta}{\cs gamma}\$")
157 \end{progcode}
160 \section{Plotting of graphs}
162 \subsection{General aspects}
164 \question{c}{How do I generate a graph from data as simply as possible?}
166 {\label{q:mingraphdata}
167 Suppose that you have a data file \texttt{x.dat} containing values for
168 $x$ and $y$ in two columns. Then the following code will do the job
169 \begin{progcode}
170 from pyx import *\\
172 g = graph.graphxy(width=10)\\
173 g.plot(graph.data("x.dat", x=1, y=2))\\
174 g.writetofile("x")
175 \end{progcode}
176 \texttt{graphxy} creates a canvas (called \texttt{g} in this example) onto
177 which the graph will be drawn and sets the default behavior including the
178 axis. There is, however, no default value for the width of the graph. In
179 \texttt{plot} you have to specify the name of the data file and the columns
180 from which the data should be taken. Finally, \texttt{writetofile} will
181 generate the postscript file \texttt{x.eps} which you can view or print.
183 A minimal example is also provided in the \PyX{} distribution as
184 \path{examples/graphs/minimal.py}.
187 \question{a}{How do I generate a graph of a function as simply as possible?}
189 {The following example will draw a parabola:
190 \begin{progcode}
191 from pyx import *\\
193 g = graph.graphxy(width=10,\\
194 ~~~~~~~~~~~~~~~~~~x=graph.linaxis(min=-2, max=2)\\
195 ~~~~~~~~~~~~~~~~~~)\\
197 g.plot(graph.function("y=x\^{}2"))\\
199 g.writetofile("x")
200 \end{progcode}
201 Most of the code has been explained in \uaref{q:mingraphdata}. The main
202 difference is that here you need to specify minimum and maximum for the
203 $x$-axis so that \PyX{} knows in which range to evaluate the function.
205 See \uaref{q:zerolineattrs} for an explanation of how one can suppress the
206 zero lines.
208 Another, slightly more complex, example is also provided in the \PyX{}
209 distribution as \path{examples/graphs/piaxis.py}.
212 \question{t}{How can I stack graphs?}
213 {maybe we should recommend using the bbox.height() method instead of
214 using g.height?)}
215 {\PyX{} always needs a canvas to draw on. One possibility therefore consists
216 in creating a new canvas with
217 \begin{progcode}
218 c = canvas.canvas()
219 \end{progcode}
220 and inserting the graphs into this canvas with \texttt{c.insert(...)}. Here,
221 \texttt{...} has to be replaced by the name of the graph. Alternatively, the
222 canvas created with \texttt{graph.graphxy} for one of the graphs can be used
223 to insert the other graphs even if they will be positioned outside the
224 first graph.
226 The second issue to address is positioning of the graphs. By specifying
227 \texttt{xpos} and \texttt{ypos} when calling \texttt{graphxy}, you can
228 define the position of a graph. Later on, the position and size of a
229 graph \texttt{g} can be referred to as \texttt{g.xpos}, \texttt{g.ypos},
230 \texttt{g.width}, and \texttt{g.height} even if for example the height has
231 never been specified explicitly but is only defined by a \PyX{} default.
233 The following example shows how to put graph \texttt{gupper} above graph
234 \texttt{glower} on a canvas \texttt{c}:
235 \begin{progcode}
236 from pyx import *\\
237 from graph import graphxy\\
239 c = canvas.canvas()\\
241 glower = graphxy(width=10)\\
242 glower.plot(...)\\
243 c.insert(glower)\\
245 gupper = graphxy(width=10, ypos=glower.ypos+glower.height+2)\\
246 gupper.plot(...)\\
248 c.insert(gupper)\\
249 c.writetofile(...)
250 \end{progcode}
251 where \texttt{...} has to be replaced by the appropriate information like
252 data and symbol specifications and the name of the output file. Here,
253 \texttt{c.insert} is used to actually insert the subcanvasses
254 for the graphs into the main canvas \texttt{c} and \texttt{c.writetofile}
255 in the last line requests to write the contents of this canvas to a file.
257 %In order to suppress the labels of the $x$-axis of the upper graph, use
258 %\begin{progcode}
259 %myaxispainter = graph.axispainter(labelattrs=None)
261 %gupper = graph.graphxy(...,
262 % x=graph.linaxis(...,
263 % part=graph.linpart(),
264 % painter=myaxispainter)
266 %\end{progcode}
269 \question{t}{How can I plot grid data?}
273 \question{t}{I would like a key for only some of my data sets. How do I do
274 that?}
279 \subsection{Axis properties}
281 \question{a}{How do I specify the tick increment?}
283 {In the partition of a linear axis, the increments associated with ticks,
284 subticks etc.\ can be specified as argument of \texttt{linpart}. In the
285 following example, ticks will be drawn at even values while subticks will
286 be drawn at all integers:
287 \begin{progcode}
288 tg = graph.graphxy(width=10,\\
289 ~~~~~~~~~~~~~~~~~~~x=graph.linaxis(min=1, max=10,\\
290 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~part=graph.linpart(tickdist=[2,1]))\\
291 ~~~~~~~~~~~~~~~~~~~)
292 \end{progcode}
295 \question{a}{Why are the axes extended beyond the data range?}
297 {Because the developers like it this way (God knows why). One way to avoid
298 this extension is to explicitly specify the minimum and maximum values for
299 the axis. The other possibility is to set \texttt{datavmin=0} and/or
300 \texttt{datavmax=1} in \texttt{linaxis} or \texttt{logaxis}.
302 Changes in the extension of axes are announced for version 0.5.
305 \question{a}{How do I get rid of the zero line?}
307 {\label{q:zerolineattrs}
308 The \texttt{axispainter} takes an argument \texttt{zerolineattrs} which
309 defaults to an empty list. Setting the \texttt{axispainter} for the
310 appropriate axis to \texttt{None} will remove the zero line like in this
311 example:
312 \begin{progcode}
313 myaxispainter = graph.axispainter(zerolineattrs=None)\\
315 g = graph.graphxy(width=10,\\
316 ~~~~~~~~~~~~~~~~~~x=graph.linaxis(min=-5, max=5, painter=myaxispainter),\\
317 ~~~~~~~~~~~~~~~~~~y=graph.linaxis(min=-5, max=5)\\
318 ~~~~~~~~~~~~~~~~~~)
319 \end{progcode}
320 This will keep the horizontal zero line but discard the vertical one.
323 \subsection{Data properties}
325 \question{a}{How do I choose the symbol?}
327 {\label{q:choose_symbol}
328 Suppose a graph called \texttt{g} has been initialized, e.g. using
329 \texttt{graph.graphxy}. Then, data and the style of their representation
330 in the graph are defined by calling \texttt{g.plot} like in the following
331 example in which filled circles are requested:
332 \begin{progcode}
333 g.plot(graph.data("test.dat"),\\
334 ~~~~~~~graph.symbol(graph.symbol.circle,symbolattrs=deco.filled()\\
335 ~~~~~~~)
336 \end{progcode}
339 \question{a}{How do I choose the color of the symbols?}
341 {Colors are not properties of the symbol as such and can therefore not
342 be specified in \texttt{symbolattrs} directly. The color is rather related
343 to the plotting of the symbol as defined by \texttt{deco.stroked()} or
344 \texttt{deco.filled()}. With
345 \begin{progcode}
346 graph.symbol(graph.symbol.circle,\\
347 ~~~~~~~~~~~~~symbolattrs=[deco.stroked(color.rgb.red),\\
348 ~~~~~~~~~~~~~~~~~~~~~~~~~~deco.filled(color.rgb.green)]\\
349 ~~~~~~~~~~~~~)
350 \end{progcode}
351 you will obtain a circle filled in green with a red borderline.
354 \question{a}{How do I choose the line style?}
356 {If you do not want to use symbols, you can set the line style as in this
357 example
358 \begin{progcode}
359 g.plot(graph.data("test.dat"),\\
360 ~~~~~~~graph.line(lineattrs=style.linewidth.Thin)\\
361 ~~~~~~~)
362 \end{progcode}
363 where the linewidth is set.
365 If you also want to use symbols, you can set the line attributes together
366 with the symbols. Extending the example in \ref{q:choose_symbol}),
367 you could use
368 \begin{progcode}
369 g.plot(graph.data("test.dat"),\\
370 ~~~~~~~graph.symbol(graph.symbol.circle, \\
371 ~~~~~~~~~~~~~~~~~~~~symbolattrs=deco.filled(),\\
372 ~~~~~~~~~~~~~~~~~~~~lineattrs=[style.linewidth.Thin, style.linestyle.dashed]\\
373 ~~~~~~~~~~~~~~~~~~~~)\\
374 ~~~~~~~)
375 \end{progcode}
376 to set the linewidth and to choose dashed lines.
379 \section{\TeX{} and \LaTeX{}}
381 \subsection{General aspects}
383 \question{a}{What is \TeX/\LaTeX{} and why do I need it?}
385 {\label{q:what_is_tex}
386 \TeX{} is a high quality typesetting system developed by Donald E. Knuth
387 which is available for a wide variety of operating systems. \LaTeX{} is a
388 macro package originally developed by Leslie Lamport which makes life with
389 \TeX{} easier, in particular for complex typesetting tasks. The current
390 version of \LaTeX{} is referred to as \LaTeXe{} and offers e.g.\ improved
391 font selection as compared to the older \LaTeX{} 2.09 which should no longer
392 be used.
394 All typesetting tasks in \PyX{} are finally handed over to \TeX{} (which is the
395 default) or \LaTeX{}, so that \PyX{} cannot do without it. On the other hand,
396 the capabilities of \TeX{} and \LaTeX{} can be used for complex tasks where
397 both graphics and typesetting are needed.
400 \question{a}{I don't know anything about \TeX{} and \LaTeX{}. Where can I read
401 something about it?}
403 {\label{q:intro_tex_latex}
404 Take a look at CTAN (\uaref{q:ctan}) where in \ctan{info}
405 you may be able to find some useful information. There exists for example
406 ``A Gentle Introduction to \TeX'' by M.~Doob (\ctan{gentle/gentle.pdf}) and
407 ``The Not So Short Introduction to \LaTeXe''
408 (\ctan{info/lshort/english/lshort.pdf}) by T.~Oetiker et al. The latter has
409 been translated into a variety of languages among them korean (which you will
410 not be able to read unless you have appropriate fonts installed) and mongolian.
412 Of course, it is likely that these documents will go way beyond what you
413 will need for generating graphics with \PyX{} so you don't have to read all
414 of it (unless you want to use \TeX{} or \LaTeX{} for typesetting which can be
415 highly recommended).
417 There exists also a number of FAQs on \TeX{} at \ctan{help}.
420 \question{a}{What is CTAN?}
422 {\label{q:ctan}
423 CTAN is the Comprehensive TeX Archive Network where you will find almost
424 everything related to \TeX{} and friends. The main CTAN servers are
425 \url{tug.ctan.org}, \url{dante.ctan.org}, and \url{cam.ctan.org}. A list of
426 FTP mirrors can be found at \ctan{CTAN.sites}.
428 In this FAQ, \texttt{CTAN:} refers to the root of an anonymous ftp CTAN tree,
429 e.g. \url{ftp://ctan.tug.org/tex-archive/},
430 \url{ftp://ftp.dante.de/tex-archive/},
431 and \url{ftp://ftp.tex.ac.uk/tex-archive/}. The links to CTAN in this document
432 point to one of these servers but you might consider using a FTP mirror closer
433 to you in order to reduce traffic load.
436 \question{a}{Is there support for Con\TeX{}t?}
438 {No, and as far as I know there no plans to provide it in the near future.
439 Given the close ties between Con\TeX{}t and Meta\-Post, Con\TeX{}t users
440 probably prefer to stick with the latter anyway.
443 \subsection{\TeX{} and \LaTeX{} commands useful for \PyX}
445 \question{a}{How do I get a specific symbol with \TeX{} or \LaTeX?}
447 {A list of mathematical symbols together with the appropriate command name
448 can be found at \ctan{info/symbols/math/symbols.ps}. A comprehensive list
449 containing more than 2500 symbols for use with \LaTeX{} can be obtained from
450 \ctan{info/symbols/comprehensive/symbols-a4.pdf}. In some cases it might be
451 necessary to install fonts or packages available from CTAN
452 (\uaref{q:ctan}).
455 \subsection{\TeX{} and \LaTeX{} errors}
457 \question{a}{Undefined control sequence \cs{usepackage}}
459 {\label{q:undefined_usepackage}
460 The command \cs usepackage is specific to \LaTeX{}. Since by default \PyX{}
461 uses \TeX{}, you have to specify the correct mode:
462 \begin{progcode}
463 text.set(mode="latex")
464 \end{progcode}
467 \question{a}{Undefined control sequence \cs{frac}}
469 {\label{q:undefined_frac}
470 The command \cs frac is only available in \LaTeX{}. In \TeX{} you should
471 use \texttt{\cb{a\cs over b}} in math mode to produce ${a\over b}$. As an
472 alternative you may ask for the \LaTeX{} mode as explained in
473 \ref{q:undefined_usepackage}.
476 \question{a}{Missing \$ inserted}
478 {You have specified \TeX- or \LaTeX-code which is only valid in math mode.
479 Typical examples are greek symbols, sub- and superscripts or fractions.
481 On the \PyX{} level, you can specify math mode for the whole string by using
482 \texttt{text.mathmode} as in
483 \begin{progcode}
484 c.text(0, 0, r"{\cs alpha}", text.mathmode)
485 \end{progcode}
486 Keep also in mind that the standard Python interpretation of the backslash as
487 introducing escape sequences needs to be prevented
488 \uaref{q:raw_string}.
490 On the \TeX/\LaTeX{} level you should enclose the commands requiring math
491 mode in \$'s. As an example, \texttt{\$\cs alpha\us i\hat j\$} will produce
492 $\alpha_i^j$. This allows you to specify math mode also for substrings. There
493 exist other ways to specify math mode in \TeX{} and \LaTeX{} which are
494 particularly useful for more complex typesetting tasks. To learn more about
495 it, you should consult the documentation
496 \uaref{q:intro_tex_latex}.
499 \question{a}{Font shape `OT1/xyz/m/n' undefined}
501 {\label{q:fontshape_undefined}
502 You have asked to use font \texttt{xyz} which is not available. Make sure that
503 you have this font available in Type1 format, i.e.\ there should be a
504 file \texttt{xyz.pfb} somewhere. If your \TeX{} system is TDS compliant
505 (TDS=\TeX{} directory structure, cf.\ \ctan{tds/draft-standard/tds/tds.pdf})
506 you should take a look at the subdirectories of
507 \path{TEXMF/fonts/type1}.
510 \question{t}{No information for font `cmr10' found in font mapping file}
511 {rewrite this taking into account the pyxrc file}
512 {\label{q:no_cmr10}
513 Such an error message can already be encountered by simply running the example
514 file \texttt{hello.py} included in the \PyX{} distribution. The likely reason
515 is that the \TeX{} system does not find the cmr fonts in Type1 format.
516 \PyX{} depends on these fonts as it does not work with the traditional
517 pk fonts which are stored as bitmaps.
519 Therefore, the first thing to make sure is that the cmr Type1 fonts are
520 installed. In some \TeX{} installations, the command \texttt{kpsewhich
521 cmr10.pfb} will return the appropriate path if the cmr fonts exist in the
522 binary Type1 format (extension \texttt{pfb}) required by \PyX. If the command
523 does not work but the TeX{} system is TDS compliant
524 (\uaref{q:fontshape_undefined}), a look should be taken at
525 \path{TEXMF/fonts/type1/bluesky/cm} where \texttt{TEXMF} is the root of the
526 \texttt{texmf} tree.
528 If the Type1 fonts do not exist on the system, they may be obtained from
529 the CTAN \uaref{q:ctan} at \ctan{fonts/cm/ps-type1/bluesky}. See the
530 \texttt{README} for information about who produced these fonts and why they
531 are freely available.
533 If the Type1 fonts exist, the next step is to take a look at
534 \texttt{psfonts.map}. There may be several files with this name on the system,
535 so it is important to find out which one TeX is actually using.
536 \texttt{kpsewhich psfonts.map} might give this information.
538 The most likely problem is that this file does not contain a line telling TeX
539 what to do if it encounters a request for font cmr10, i.e. the following line
540 may be missing
541 \begin{progcode}
542 ~~~cmr10~~~~~~~~~~~CMR10~~~~~~~~~~~<cmr10.pfb
543 \end{progcode}
544 It is probable that the required lines (in practice, you do not just need
545 cmr10) are found in a file named \texttt{psfonts.cmz} which resides in
546 \path{TEXMF/dvips/bluesky}. The contents of \texttt{psfonts.cmz} should
547 be inserted into \texttt{psfonts.map}. Probably, \texttt{psfonts.map} recommends
548 not to do this by hand. In this case the instructions should be followed.
549 Otherwise, \texttt{psfonts.cmz} should be copied into \texttt{psfonts.map}
550 while keeping a backup of the old \texttt{psfonts.map} just in case. After
551 these changes \PyX{} most likely will be happy. When inserting
552 \texttt{psfonts.cmz} into \texttt{psfonts.map} it may be a good idea to
553 include \texttt{psfonts.amz} as well. \texttt{psfonts.amz} contains information
554 about some more fonts which might be needed at some point.
556 Making these changes will imply that the \TeX{} system will use the cmr fonts
557 in Type1 format instead of pk format which is actually not a bad thing, in
558 particular if \texttt{latex}~/ \texttt{dvips}~/ \texttt{ps2pdf} is used to
559 generate PDF output. With fonts in pk format this will look ugly and using
560 Type1 fonts solves this problem as well. When \texttt{pdflatex} is used to
561 create PDF files, Type1 fonts will be used anyway.
563 An alternative to changing the file \texttt{psfonts.map} in the \TeX{} system
564 consists in instructing \PyX{} to read other map files like
565 \texttt{psfonts.cmz} as well. This can be achieved by adding map files in the
566 following line of
567 \texttt{pyx/text.py}:
568 \begin{progcode}
569 fontmap = readfontmap(["psfonts.map"])
570 \end{progcode}
572 It may well be that future versions of \PyX{} take care of this problem so that
573 one needs no longer to worry about \texttt{psfonts.map}, at least for the
574 standard cmr fonts.
577 \question{o}{No information for font `xyz7t' found in font mapping file}
578 {I think we should delete this question for the release, because it
579 should no longer be applicable to PyX 0.5 and above.}
580 {After verifying that your problem was not addressed in \uaref{q:no_cmr10},
581 you should switch on virtual font support by using \texttt{text.set(dvicopy=1)}.
582 For those interested in more details: setting this option will cause
583 \texttt{dvicopy} to be run after a \texttt{dvi}-file has been created by a call
584 to \TeX/\LaTeX. \texttt{dvicopy} expands any references to virtual fonts to
585 base fonts and thus produces a modified copy of the original \texttt{dvi}-file.
587 If this does not help, verify the existence of \texttt{xyz7t.vf} in one of the
588 subdirectories of \path{TEXMF/fonts/vf} (again, a TDS compliant \TeX{}
589 system is assumed \uaref{q:fontshape_undefined}). If the
590 virtual font file exists, find out which font it requests. A human readable
591 version of the virtual font file can be obtained with the help of
592 \texttt{vftovp}. A Unix operating system should allow you to obtain the
593 fontname by means of
594 \begin{progcode}
595 vftovp xyz7t.vf|grep FONTNAME
596 \end{progcode}
597 The resulting fontname has to be listed in \texttt{psfonts.map}. Use
598 \begin{progcode}
599 kpsewhich psfonts.map
600 \end{progcode}
601 to find out where this file resides (there may be more than one and it is
602 important to know which one is actually read).
605 \subsection{Fonts}
607 \question{t}{I have Type1 fonts in \texttt{pfa} format. How do I obtain the
608 corresponding \texttt{pfb} files needed by \PyX?}
613 \question{a}{I want to use a font other than computer modern roman}
615 {\label{q:other_font}
616 As long as you have a font in Type1 format available, this should be no
617 problem (even though it may cost you some time to set up things properly).
619 In the simplest case, your \LaTeX{} system contains everything needed.
620 Including the following line into your code will probably work
621 \begin{progcode}
622 text.set(mode="latex")\\
623 text.preamble(r"\cs{usepackage}\cb{mathptmx}")
624 \end{progcode}
625 and give you Times as roman font.
627 If you own one of the more common commercial fonts, take a look at
628 \ctan{fonts} and its subdirectories as well as at the web page
629 \url{http://home.vr-web.de/was/fonts.html} of Walter Schmidt. It is not
630 unlikely that somebody has already done most of the work for you and created
631 the files needed for the font to work properly with \LaTeX. But remember:
632 we are talking about commercial fonts here, so do not expect to find the fonts
633 themselves for free.
635 If none of these cases applies, you should spend some time reading
636 manuals about font installation, e.g.\ \ctan{macros/latex/doc/fntguide.pdf}
637 (of course, I do not expect font wizards to read the last few lines).
640 \question{a}{Can I use a TrueType font with \PyX?}
642 {Not directly as \PyX{} only knows how to handle Type1 fonts (although it is
643 possible to get \LaTeX{} to work with TrueType fonts). However, you may use
644 \texttt{ttf2pt1} (from \url{http://ttf2pt1.sourceforge.net}) to convert a
645 TrueType font into a Type1 font which you then install in your \TeX{} system
646 \uaref{q:other_font}. You will loose hinting information
647 in the conversion process but this should not really matter on output devices
648 with not too low resolution.
651 \end{document}