summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/lettrine/doc/demo-lua.tex
blob: 4492ade68e1ddcde84e80078f96bbdc06cfce009 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
\documentclass[12pt,paper=a4,german,french,british]{scrartcl}

\usepackage{lettrine}
\usepackage[dvipsnames]{xcolor}
\usepackage[colorlinks, urlcolor=ForestGreen, linkcolor=blue]{hyperref}

%%% Linux Libertine fonts...
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
%\setsansfont{TeX Gyre Heros}[Scale=MatchLowercase]
\setmonofont{Latin Modern Mono}[Scale=MatchLowercase]

\usepackage{Typocaps}

\usepackage{babel}
\frenchbsetup{AutoSpacePunctuation=false, og=«,fg=»}
\babeltags{fr=french, de=german, uk=british}

\newcommand*{\file}[1]{\texttt{#1}}
\newcommand*{\cs}[1]{\texttt{\boi#1}}
\newcommand*{\MF}{{\small\scshape metafont}}

\setlength{\parindent}{0pt}
\sloppy

\begin{document}
\thispagestyle{empty}
\enlargethispage{2\baselineskip}

\begin{center}
\large\bfseries Some LuaLaTeX examples
\end{center}

Both files \file{demo-fr.tex} and \file{demo-de.tex} can be compiled either with
pdfLaTeX or with LuaLaTeX or XeLaTeX. The purpose of the next examples is to
show how easy it is to change the font for the dropped initial with Unicode
engines: no need to care about the low-level NFSS syntax, a simple
\cs{fontspec} call will do the trick.

\vspace{.5\baselineskip}
In the first example, \textit{ Linux Libertine Initials} is used for the
dropped capital:\\
\verb+\renewcommand{\LettrineFontHook}{\fontspec{LinLibertine_I.otf}}+\\
\verb+\lettrine[lines=3]{E}{n plein marais de la Souteyranne...}+

\begin{fr}
  \renewcommand{\LettrineFontHook}{\fontspec{LinLibertine_I.otf}}
  \lettrine[lines=3]{E}{n plein marais de la Souteyranne}, à quelques
  kilomètres au nord d'Aigues-Mortes, se trouve la Tour Carbonnière.
  Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès
  terrestre de la ville fortifiée, celle qui menait à Psalmody,
  l'une des « abbayes de sel» dont il ne reste que quelques vestiges.\par
\end{fr}

\vspace{.5\baselineskip}
Of course, it is still possible to use Type\,1 fonts for the dropped capitals,
here \textit{Typocaps} (red):\\
\verb+\renewcommand{\LettrineFontHook}{\Typocapsfamily\color{red}}+\\
\verb+\lettrine[findent=.3em]{E}{n plein marais de la Souteyranne}...+

\begin{fr}
\renewcommand{\LettrineFontHook}{\Typocapsfamily\color{red}}
\lettrine[findent=.3em]{E}{n plein marais de la Souteyranne}, à quelques
kilomètres au nord d'Aigues-Mortes, se trouve la Tour Carbonnière.
Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès
terrestre de la ville fortifiée.\par
\end{fr}

\vspace{.5\baselineskip}
OpenType and TrueType free fonts are available for Old German, here is an example
featuring the \textit{Yinit} OpenType font%
\footnote{produced by Élie Roux from Yannis Haralambous’ Gothic Initials
  originally in \MF.}
for the initial and \textit{UnifrakturMaguntia} TrueType font%
\footnote{\url{http://unifraktur.sourceforge.net/maguntia.html}}
for the running text.  The later has several nice \textit{optional features},
(here long s and old umlaut variant):

\verb+\setmainfont{UnifrakturMaguntia.ttf}[StylisticSet=11,CharacterVariant=15]+\\
\verb+\renewcommand{\LettrineTextFont}{\relax} % No small caps here!+ \\
\verb+\renewcommand{\LettrineFontHook}{\fontspec{Yinit.otf}}+\\
\verb+\lettrine[lhang=.2, loversize=.25, findent=0.1em]{W}{er} reitet+

\begin{de}\Large
\setmainfont{UnifrakturMaguntia.ttf}[StylisticSet=11,CharacterVariant=15]
\renewcommand{\LettrineTextFont}{\relax}
\renewcommand{\LettrineFontHook}{\fontspec{Yinit.otf}}
\lettrine[lhang=.2, loversize=.25, findent=0.1em]
{W}{er} reitet so spät durch Nacht und Wind?\\
Es ist der Vater mit seinem Kind;\\
Er hat den Knaben wohl in dem Arm,\\
Er faßt ihn sicher, er hält ihn warm.\par
\end{de}

\vspace{.5\baselineskip}
Without the \textit{optional features}, the output looks more modern:

\begin{otherlanguage}{german}\Large
\setmainfont{UnifrakturMaguntia.ttf}
\renewcommand{\LettrineTextFont}{\relax}
\renewcommand{\LettrineFontHook}{\fontspec{Yinit.otf}}
\lettrine[lhang=.2, loversize=.25, findent=0.1em]
{W}{er} reitet so spät durch Nacht und Wind?\\
Es ist der Vater mit seinem Kind;\\
Er hat den Knaben wohl in dem Arm,\\
Er faßt ihn sicher, er hält ihn warm.\par
\end{otherlanguage}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% coding: utf-8
%%% TeX-master: t
%%% TeX-engine: luatex
%%% End: