]> git.lyx.org Git - wiki-uploads.git/blob - LyX/Manuals/turner-fonts.lyx
Import uploads from wiki
[wiki-uploads.git] / LyX / Manuals / turner-fonts.lyx
1 #LyX 1.3 created this file. For more info see http://www.lyx.org/
2 \lyxformat 221
3 \textclass article
4 \begin_preamble
5
6 \end_preamble
7 \language english
8 \inputencoding auto
9 \fontscheme default
10 \graphics default
11 \paperfontsize default
12 \spacing single 
13 \papersize Default
14 \paperpackage a4
15 \use_geometry 0
16 \use_amsmath 0
17 \use_natbib 0
18 \use_numerical_citations 0
19 \paperorientation portrait
20 \secnumdepth 3
21 \tocdepth 3
22 \paragraph_separation indent
23 \defskip medskip
24 \quotes_language english
25 \quotes_times 2
26 \papercolumns 1
27 \papersides 1
28 \paperpagestyle default
29
30 \layout Subsection
31
32 Using different fonts in LyX
33 \layout Standard
34
35 by 
36 \noun on 
37 Robin Turner
38 \layout Standard
39
40
41 \begin_inset ERT
42 status Collapsed
43
44 \layout Standard
45
46 \backslash 
47 newfont{
48 \backslash 
49 yinit}{yinit}
50 \backslash 
51 yinit
52 \end_inset 
53
54
55 \layout Standard
56
57
58 \begin_inset ERT
59 status Collapsed
60
61 \layout Standard
62
63 \backslash 
64 normalfont
65 \end_inset 
66
67  yX currently uses a fairly limited selection of fonts.
68  While it may come as a disappointment to people used to the thousands of
69  TrueType fonts available to conventional word processors, there are in
70  fact good reasons for this choice.
71  LyX actually has no fonts of its own; for the screen it uses whatever fonts
72  are available to the X-window system, and for output it uses the fonts
73  of the TeX setup it is operating with.
74  The selection of default faults correspond to the most useful and commonly-foun
75 d fonts available in TeX.
76  The 
77 \begin_inset Quotes eld
78 \end_inset 
79
80 L
81 \begin_inset Quotes erd
82 \end_inset 
83
84  at the beginning of this section is a case in point: most TeX distributions
85  include the 
86 \family typewriter 
87 yinit
88 \family default 
89  font, so you should see a nice decorated 
90 \begin_inset Quotes eld
91 \end_inset 
92
93 L
94 \begin_inset Quotes erd
95 \end_inset 
96
97  at the beginning; some distributions may not, so you won't.
98 \layout Standard
99
100 Another point is that the profusion of fonts which TrueType brought about
101  has generally had a bad effect on desktop publishing, leading to documents
102  with inappropriate, badly-scaled or simply too many fonts.
103  You should therefore think carefully before using a different default font,
104  or mixing font families in the same document.
105 \layout Standard
106
107 Nevertheless, you can, with a little Evil Red Text, make LyX produce just
108  about any font you want, and even design your own fonts.
109  What follows is a 
110 \begin_inset Quotes eld
111 \end_inset 
112
113 quick fix
114 \noun on 
115
116 \begin_inset Quotes erd
117 \end_inset 
118
119
120 \noun default 
121  guide; it is no substitute for reading a good book on (La)TeX.
122 \layout Subsubsection
123
124 Changing the default font
125 \layout Standard
126
127 The easiest and most reliable way to change the default font is from within
128  LyX, through 
129 \family sans 
130 Layout\SpecialChar \menuseparator
131 Document\SpecialChar \menuseparator
132 Fonts
133 \family default 
134 .
135  The next easiest is to use a package contained in your TeX distribution.
136  For example, the rather pretty Pandora font family can be accessed simply
137  by putting 
138 \family typewriter 
139
140 \backslash 
141 usepackage{pandora}
142 \family default 
143  in your LaTeX preamble (
144 \family sans 
145 Layout\SpecialChar \menuseparator
146 L
147 \begin_inset ERT
148 status Inlined
149
150 \layout Standard
151 {}
152 \end_inset 
153
154 aT
155 \begin_inset ERT
156 status Inlined
157
158 \layout Standard
159 {}
160 \end_inset 
161
162 eX\SpecialChar ~
163 preamble
164 \family default 
165 ).
166  Similarly, 
167 \family typewriter 
168
169 \backslash 
170 usepackage{oldgerm}
171 \family default 
172  in the preamble gives you access to Yannis Haralambous' Old German (Gothisch)
173  fonts via the specially-defined 
174 \family typewriter 
175
176 \backslash 
177 gothfamily
178 \family default 
179
180 \family typewriter 
181
182 \backslash 
183 swabfamily
184 \family default 
185 , and 
186 \family typewriter 
187
188 \backslash 
189 frakfamily 
190 \family default 
191 commands, which you insert in your document (as TeX) to obtain the desired
192  font (note that nothing will change in your screen display, which considering
193  the difficulty involved in reading some of these fonts is just as well).
194  Other useful packages are 
195 \family typewriter 
196 concrete
197 \family default 
198 , which gives access to both the Concrete Roman and the Euler math fonts,
199  and 
200 \family typewriter 
201 chancery
202 \family default 
203 , which gives you the Zapf Chancery font
204 \layout Standard
205
206 A less reliable method is the
207 \family typewriter 
208  
209 \backslash 
210 familydefault
211 \family default 
212  command.
213  If you have a font installed and know its family name, you can put something
214  like 
215 \layout Quote
216
217
218 \family typewriter 
219
220 \backslash 
221 renewcommand{
222 \backslash 
223 familydefault}{pzc} 
224 \layout Standard
225
226 in the preamble (
227 \begin_inset Quotes eld
228 \end_inset 
229
230 pzc
231 \begin_inset Quotes erd
232 \end_inset 
233
234  is the family name for the Zapf Chancery font).
235  You should be aware, however, that this method may produce strange results
236  if the font you have selected does not have the sizes or shapes you want
237  (e.g., adding emphasis to text has no effect on Zapf Chancery, and choosing
238  the sans serif or typewriter series will cause it to revert to the standard
239  font).
240 \layout Subsubsection
241
242 More than one font family in one document
243 \layout Standard
244
245 As I've said, different font families in the same document can spell trouble.
246  Unlike many human families, the members of a font family work well together,
247  so the eye is not overly disturbed when changing from a medium roman to
248  a bold sans serif font, for example.
249  Different font families may not have this visual compatibility, and clashing
250  fonts are a common reason for amateur publishing looking amateurish.
251  (End of sermon.)
252 \layout Standard
253
254 Nevertheless, you may need different fonts for some reason: maybe you have
255  to include a different alphabet, like Klingon or Cuneiform
256 \begin_inset Foot
257 collapsed true
258
259 \layout Standard
260
261 These can be downloaded from CTAN.
262  Remember, though, that some 
263 \begin_inset Quotes eld
264 \end_inset 
265
266 normal
267 \begin_inset Quotes erd
268 \end_inset 
269
270  fonts can be turned into a different alphabet by changing the font encoding;
271  see a good LaTeX book if you want to do this.
272 \end_inset 
273
274 , or you want a structural/aesthetic effect, such as putting poetry in a
275  different font from prose, like this:
276 \layout Standard
277
278
279 \begin_inset ERT
280 status Collapsed
281
282 \layout Standard
283
284 \backslash 
285 newfont{
286 \backslash 
287 poetry}{eurm8}
288 \backslash 
289 poetry
290 \end_inset 
291
292
293 \layout Verse
294
295 Myself when young did eagerly frequent
296 \newline 
297 Emacs and vi, and heard great Argument
298 \layout Standard
299
300
301 \begin_inset ERT
302 status Collapsed
303
304 \layout Standard
305
306 \backslash 
307 normalfont
308 \end_inset 
309
310  One way to do this is to declare your own font commands.
311  For example, writing 
312 \layout Quote
313
314
315 \family typewriter 
316
317 \backslash 
318 newfont{
319 \backslash 
320 avant}{pagd} 
321 \layout Standard
322
323 will define a command, 
324 \family typewriter 
325
326 \backslash 
327 avant
328 \family default 
329 , which can be invoked anywhere in your document to change to the 
330 \begin_inset ERT
331 status Collapsed
332
333 \layout Standard
334
335 \backslash 
336 newfont{
337 \backslash 
338 avant}{pagd}
339 \backslash 
340 avant
341 \end_inset 
342
343  Avant Garde font.
344  
345 \begin_inset ERT
346 status Collapsed
347
348 \layout Standard
349
350 \backslash 
351 normalfont
352 \end_inset 
353
354  You can return to your default font by typing 
355 \family typewriter 
356
357 \backslash 
358 normalfont
359 \family default 
360 .
361 \layout Standard
362
363 Some fonts will perform adequately with just the basic font name (as above);
364  others require that you specify a font size; for example, the verse above,
365  aside from mangling Omar Khayyam, used the font command 
366 \family typewriter 
367 eurm8
368 \family default 
369  (i.e.\SpecialChar ~
370 Euler Roman 8pt).
371 \layout Standard
372
373 Some fonts may also need scaling using the 
374 \family typewriter 
375 scaled
376 \backslash 
377 magstep
378 \family default 
379 \emph on 
380 n
381 \emph default 
382  option, since their idea of, say, 10pt, may not be the same as that of
383  your default font family.
384  If the font looks too small, try a command like this:
385 \layout Quote
386
387
388 \backslash 
389 newfont{
390 \backslash 
391 zapf}{pzci10 scaled
392 \backslash 
393 magstep1}
394 \layout Standard
395
396 This scales the rather small-looking Zapf Chancery font so that it looks
397  the same size as the default (10pt) font.
398  If your font looks too big, select a smaller fontsize (e.g., 8pt) and scale
399  up.
400 \layout Subsubsection
401
402 Finding new fonts
403 \layout Standard
404
405 So where do you find all these exciting new fonts? There are three main
406  methods:
407 \layout Enumerate
408
409 Look around in your TeX distribution.
410 \layout Enumerate
411
412 Download TeX fonts.
413 \layout Enumerate
414
415 Convert TrueType fonts to TeX.
416 \layout Standard
417
418 The first stage is as far as most people will want to go.
419  Have a look in
420 \family sans 
421  
422 \family typewriter 
423 $TEXMF/fonts/tfm
424 \family default 
425  to see what you've got (where 
426 \family typewriter 
427 $TEXMF
428 \family default 
429  is the location of your TeX system, usually something like
430 \family typewriter 
431  /usr/share/texmf
432 \family default 
433 ).
434  When you see something that looks promising, test it in a LyX document
435  using the method described above, i.e.
436  make a new font command and use it on some text, then preview and see what,
437  if anything, you get.
438  Note that the font name you want is usually the first four letters of the
439  file name, e.g., a file named 
440 \family typewriter 
441 pncb8a.afm
442 \family default 
443  is actually the bold (b) version of Adobe's (p) New Century (nc) family.
444  If in doubt about names, check out the files in 
445 \family typewriter 
446 $TEXMF/fontname
447 \family default 
448 .
449 \layout Standard
450
451 TeX fonts can be downloaded from your nearest CTAN mirror (e.g., 
452 \begin_inset LatexCommand \url{ftp.ivorytower.edu/pub/tex/ctan/fonts}
453
454 \end_inset 
455
456 ).
457  At first, look for font directories which include a 
458 \family typewriter 
459 .sty
460 \family default 
461  file which you can invoked in your preamble, as this will make life easier
462  (as in the case of Pandora).
463  Failing that, look for directories which give you the full set of TeX font
464  files.
465  Failing 
466 \emph on 
467 that
468 \emph default 
469 , look for an 
470 \family typewriter 
471 .afm
472 \family default 
473  file and run the program 
474 \family typewriter 
475 fontinst
476 \family default 
477  on it (read, or at least skim, the manual first---you've probably got it
478  in 
479 \family typewriter 
480 $TEXMF/doc/fontinst/base/fontinst.dvi
481 \family default 
482 ).
483  
484 \layout Standard
485
486 If all you have is an 
487 \family typewriter 
488 .mf
489 \family default 
490  file, you need to run 
491 \begin_inset ERT
492 status Open
493
494 \layout Standard
495
496 \backslash 
497 newfont{
498 \backslash 
499 mf}{logo10}
500 \backslash 
501 mf
502 \end_inset 
503
504  METAFONT 
505 \begin_inset ERT
506 status Collapsed
507
508 \layout Standard
509
510 \backslash 
511 normalfont
512 \end_inset 
513
514  on it., which is beyond the scope of this guide: read 
515 \emph on 
516 The
517 \emph default 
518  
519 \begin_inset ERT
520 status Inlined
521
522 \layout Standard
523
524 \backslash 
525 mf
526 \end_inset 
527
528  METAFONT 
529 \begin_inset ERT
530 status Collapsed
531
532 \layout Standard
533
534 \backslash 
535 normalfont
536 \end_inset 
537
538  
539 \emph on 
540 book
541 \emph default 
542  or Normal Walsh's 
543 \emph on 
544 Making TeX Work, 
545 \emph default 
546 Chapter 11.
547  
548 \layout Standard
549
550 You should now have a directory filled with downloaded or converted files;
551  now you need to put the font files in the right places.
552  Unless you're running Windows 9* or have an entire TeX system in your home
553  directory, you need to be root to do this.
554  The basic rule is to look at the extension of the file and move it to the
555  corresponding directory, and put 
556 \family typewriter 
557 .sty
558 \family default 
559  files in the 
560 \family typewriter 
561 /latex
562 \family default 
563  directory:
564 \layout Itemize
565
566
567 \family typewriter 
568 .sty, .cls 
569 \family default 
570 or
571 \family typewriter 
572  .fd 
573 \begin_inset Formula $\rightarrow$
574 \end_inset 
575
576  $TEXMF/tex/latex/
577 \family default 
578 \emph on 
579 <package_name>
580 \family typewriter 
581 \emph default 
582 /
583 \layout Itemize
584
585
586 \family typewriter 
587 .dvi, .ps 
588 \family default 
589 or
590 \family typewriter 
591  .pdf 
592 \begin_inset Formula $\rightarrow$
593 \end_inset 
594
595  $TEXMF/doc/latex/
596 \family default 
597 \emph on 
598 <package_name>
599 \family typewriter 
600 \emph default 
601 /
602 \begin_inset Foot
603 collapsed true
604
605 \layout Standard
606
607 These will be documentation files for the font, not fonts themselves.
608 \end_inset 
609
610
611 \layout Itemize
612
613
614 \family typewriter 
615 .tfm 
616 \begin_inset Formula $\rightarrow$
617 \end_inset 
618
619  $TEXMF/fonts/tfm/
620 \family default 
621 \emph on 
622 <supplier>
623 \family typewriter 
624 \emph default 
625 /
626 \family default 
627 \emph on 
628 <font_name>
629 \family typewriter 
630 \emph default 
631 /
632 \layout Itemize
633
634
635 \family typewriter 
636 .vf 
637 \begin_inset Formula $\rightarrow$
638 \end_inset 
639
640  $TEXMF/fonts/vf/
641 \family default 
642 \emph on 
643 <supplier>
644 \family typewriter 
645 \emph default 
646 /
647 \family default 
648 \emph on 
649 <font_name>
650 \family typewriter 
651 \emph default 
652 /
653 \layout Itemize
654
655
656 \family typewriter 
657 .afm 
658 \begin_inset Formula $\rightarrow$
659 \end_inset 
660
661  $TEXMF/fonts/afm/
662 \family default 
663 \emph on 
664 <supplier>
665 \family typewriter 
666 \emph default 
667 /
668 \family default 
669 \emph on 
670 <font_name>
671 \family typewriter 
672 \emph default 
673 /
674 \layout Itemize
675
676
677 \family typewriter 
678 .pfb 
679 \begin_inset Formula $\rightarrow$
680 \end_inset 
681
682  $TEXMF/fonts/type1/
683 \family default 
684 \emph on 
685 <supplier>
686 \family typewriter 
687 \emph default 
688 /
689 \family default 
690 \emph on 
691 <font_name>
692 \family typewriter 
693 \emph default 
694 /
695 \layout Itemize
696
697
698 \family typewriter 
699 .ttf 
700 \begin_inset Formula $\rightarrow$
701 \end_inset 
702
703  $TEXMF/fonts/truetype/
704 \family default 
705 \emph on 
706 <supplier>
707 \family typewriter 
708 \emph default 
709 /
710 \family default 
711 \emph on 
712 <font_name>
713 \family typewriter 
714 \emph default 
715 /
716 \layout Standard
717
718 If this sounds confusing, check out 
719 \begin_inset LatexCommand \url{http://www.ctan.org/installationadvice/}
720
721 \end_inset 
722
723 .
724 \layout Standard
725
726 Thought you were finished? Not quite.
727  First you need to hack the file 
728 \family typewriter 
729 $TEX/dvips/base/psfonts.map (
730 \family default 
731 there is a script to do this in a more orderly manner if you want---look
732  at the comments at the top of the file for details).
733 \begin_inset Foot
734 collapsed false
735
736 \layout Standard
737
738 If you don't want to, or can't change the system-wide font map, you can
739  create a .
740 \family typewriter 
741 dvipsrc
742 \family default 
743  file in your home directory which will add your own font lines.
744  See Normal Walsh's 
745 \emph on 
746 Making TeX Work, 
747 \emph default 
748 Chapter 5.
749 \end_inset 
750
751  You need to add a line describing your new font so that 
752 \family typewriter 
753 dvips
754 \family default 
755  can recognise it.
756  Look at the other lines to get an idea of the format.
757  The basic format is:
758 \layout Quote
759
760
761 \emph on 
762 TeX_name
763 \emph default 
764
765 \hfill 
766  
767 \emph on 
768 Real_name
769 \emph default 
770
771 \hfill 
772 <
773 \emph on 
774 encoding
775 \emph default 
776  
777 \emph on 
778 (optional)
779 \emph default 
780
781 \hfill 
782 <
783 \emph on 
784 pfbfilename
785 \family typewriter 
786 \emph default 
787 .pfb
788 \family default 
789 >
790 \layout Standard
791
792 If you're not sure what to write here, run 
793 \family typewriter 
794 afm2tfm
795 \family default 
796  on an .
797 \family typewriter 
798 afm
799 \family default 
800  file, and enter what comes up in the terminal.
801 \layout Standard
802
803 Now run 
804 \family typewriter 
805 texhash
806 \family sans 
807  
808 \family default 
809 (as root, of course), or 
810 \family typewriter 
811 initexmf\SpecialChar ~
812 -update-fndb
813 \family default 
814 , if you're using MikTeX on Windows.
815 \layout Standard
816
817 If that wasn't enough for you, you may want to try converting your favourite
818  TrueType font into a form that LyX can get at.
819  It's a long, tiring process, but if you really want that font, it's worth
820  it.
821  First download the program 
822 \family typewriter 
823 ttf2pt
824 \family default 
825 , run it on your font, then run 
826 \family typewriter 
827 fontinst
828 \family default 
829  on the output, and proceed as before.
830  Have a look at 
831 \begin_inset LatexCommand \url{http://www.pegasus.rutgers.edu/~elflord/unix/latex/no-bs.html}
832
833 \end_inset 
834
835 \SpecialChar ~
836 .
837 \layout Subsubsection
838
839 Making your own fonts
840 \layout Standard
841
842 There are (at least) three ways to do this.
843 \layout Paragraph
844
845 The proper way
846 \layout Standard
847
848 Set aside some time---maybe a summer vacation.
849  Get a copy of 
850 \emph on 
851 The
852 \emph default 
853  
854 \begin_inset ERT
855 status Open
856
857 \layout Standard
858
859 \backslash 
860 mf
861 \end_inset 
862
863  METAFONT 
864 \begin_inset ERT
865 status Collapsed
866
867 \layout Standard
868
869 \backslash 
870 normalfont
871 \end_inset 
872
873  
874 \emph on 
875 book
876 \emph default 
877 .
878  Learn the 
879 \begin_inset ERT
880 status Open
881
882 \layout Standard
883
884 \backslash 
885 mf
886 \end_inset 
887
888  METAFONT 
889 \begin_inset ERT
890 status Collapsed
891
892 \layout Standard
893
894 \backslash 
895 normalfont
896 \end_inset 
897
898  program.
899  Produce beautiful fonts.
900 \layout Paragraph
901
902 A quick kludge
903 \layout Standard
904
905 Get a TrueType font editor.
906  Make a TrueType font.
907  Convert to TeX.
908  This may work, but may produce rather ugly results.
909 \layout Paragraph
910
911 A very quick kludge
912 \layout Standard
913
914 If all you want is a few words (e.g., for a heading), rather than making an
915  entire font, write want you want by hand and scan it, then insert it as
916  a graphic.
917  You could in theory make a whole alphabet like this and insert each letter
918  as an inline .
919 \family typewriter 
920 eps
921 \family default 
922  file, but it would be tedious, and probably not very aesthetic.
923 \layout Subsubsection
924
925 Recommended reading
926 \layout Standard
927 \noindent 
928 For a good overview of fonts in LaTeX:
929 \layout Standard
930 \added_space_bottom smallskip \noindent 
931 Michel Goossens, Frank Mittelbach and Alexander Samarin: 
932 \emph on 
933 The LaTeX Companion.
934  
935 \emph default 
936 Addison-Wesley, 1994
937 \layout Standard
938 \noindent 
939 For more technical information about fonts and some samples:
940 \layout Standard
941 \added_space_bottom smallskip \noindent 
942 Norman Walsh: 
943 \emph on 
944 Making TeX Work
945 \emph default 
946 .
947  O'Reilly, 1994
948 \layout Standard
949 \added_space_bottom smallskip \noindent 
950 If you really, really want to design fonts:
951 \layout Standard
952 \added_space_bottom smallskip \noindent 
953 Donald Knuth: 
954 \emph on 
955 The METAFONTbook
956 \emph default 
957 .
958  Addison Wesley, 1986.
959 \the_end