summaryrefslogtreecommitdiff
path: root/info/mathtrip/doc/HowtoModify.tex
blob: e81ae6729507ae912be6fc2cc502fceb5359e223 (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
\documentclass[paper=a4,fontsize=11pt,div=19]{scrartcl}

\usepackage{GfsDidotSourire} %To define the fonts of the document

%Change the options of GfsDidot to define math fonts (since the lwarp
%package is yet loaded) and load
%the required "unicode-math" package.
\GfsDidotSetup{math-fonts=true}

\usepackage{HowtoModify}

%To mention the name of the main document
\newcommand\Doc{``MathTrip.tex''}

\begin{document}

\maketitle                   % Or titlepage/titlingpage environment.

% An article abstract would go here.
\begin{abstract}
   \setlength{\parindent}{0pt}%
   \setlength{\parskip}{.5ex plus .1ex minus .5ex}
   \noindent This text will give some details how to modify the document
        \Doc{} to compose it with a new math font without disturbing
        the tuning already done for some others math fonts.

        Since this document is very dense and uses almost all the area
        of the page, this is not a trivial task.
\end{abstract}

\tableofcontents

\section{Introduction}
  The main purpose of the document \Doc{} is to show the result of using 
a particular math font with a lot of different mathematical formulae spread
over all the different mathematical fields.

\Doc{} uses almost all the area of an A4 page and contain a lot of text. These
both aspects render the composition quite difficult since very few space remains
to the \TeX{} engine to setup the text on the page. 

It is almost impossible to let \TeX{} doing all the composition of the page
and some visual formating is mandatory. To add a little more complexity
it would be nice if the document \Doc{} could be composed easily with multiple
different fonts.

This last point is solved quite easily by specifying few parameters to the document
to specify the new font to use. But, unfortunately, this is only the beginning of the 
difficulties since the composition with a new math font destroy generally totally
the layout of the document.

The good news, however, is that it is not too difficult to tune. Almost all the critical
dimentions for the layout of the page are specified by parameters. By tuning very few
of these parameters the layout can be restored quite easily even if this is a time
consuming process.

It is too complicated to typeset all the versions of \Doc{} with all the possible fonts
in one pass or with one file. The best solution to have a document with all the possible fonts is to generate
(with an external script) all the different PDF files and merge them in one file afterwards.
To facilitate this procedure, it is possible by specifying some parameters to have a title page of
the document without all the elements used in the first page.

The last surprising difficulty encountered was the incompatibility between 
XeLaTeX and LuaLaTeX. The both engines produce different typesetting (specially
in a narrow space) and at few places the parameters have had to be tuned specifically
for LuaLaTeX (since the default \TeX{} engine used was XeLaTeX).

\begin{sloppypar}
The composition of the \Doc{} has been extensively tested with the TeXlive~2022
distribution but not yet with any other \TeX{} distributions. 
\end{sloppypar}

\section{Structure of \Doc}
The use of the LaTeX package ``nicematrix'' has greatly helped 
to better the structure of each page of the document. Each page
is a ``nicematrix'' tabular of 1 to 5 columns (but generally 3).

The main document is \fich{MathTrip.tex}. This is the start point to modify something
since it contains the inclusion of all the pages. The best way to work on a page is
to comment (in the file \fich{MathTrip.tex}) all the pages which should not be modified
and to work on one page after the other.

The second most important file is \fich{SpecificDimention.sty}. This document contains
all the parametrized values used somewhere in the document. Since the document
was done initially for the font GFS NeoHellenicMath, all the dimentions are
defined (in the macro \verb+\DefaultDimentions+) for this font. 

Some other macros are defined for the other fonts (which are usable
to typeset the document) but they contain only the deviations from the 
values used for the GFS NeoHellenic font. 

Currently these other
macros exist but are unusable since they are defined for an old
version of \Doc{} and some of the parametrized dimentions have
changed or do not exist any more. In the next version of \Doc{}
these macros will be adapted to the use of the other common math fonts
available on \acro{ctan}.

Generally, there is only few different values (for the other fonts)
since most of the values used for the GFS NeoHellenic font 
could be used with them.

The meaning of the different parameters and where they are used in the document
is explained by some comments around their declaration in
the file \fich{Spe\BR{}ci\BR{}fic\BR{}Di\BR{}men\BR{}tion.\BR{}sty}.

\section{Structure of a page}
Each page is contained in a file with a name starting with the letter \textbf{T} followed
by the number of the page. Associated to each page there is an other file
with the same name as the page but with the suffix \fich{Def} added.

This latter file is important since it contains the list of each file used
on the page to write the mathematical text. To find in what file some mathematical
text is located one should look in the file of the definitions for the corresponding
page.

For instance the page 10 (probably the most complicated one) is in the
file \fich{T10.tex} and the corresponding definitions are located in
the file \fich{T10Def.tex}.

\section{Structure of a mathematical (or text) block}
Most of the mathematical text is composed of a block of text of some dimention.
This block is placed somewhere in a page. The most important dimention
is the width of the line usable to write the mathematical text.

To be able to place correctly on the page the block of math text, a specific
structure should be used by defining a macro with a parameter (which is the
width usable for the text).

This macro should produce a \verb+\parbox+ top aligned with the required
width. Inside this parbox the mathematical text should be typeset.

\subsection{Example: block for a quote used in a page}
\lstinputlisting{ExampleDoc1.tex}

\subsection{Example: modification of a page}
If one want to modify a page, it can follow what should be done for the page 10 
(the most complicated one).

The file \fich{T10.tex} contains the code of the page (mainly an environment \verb+NiceTabular+).
The file \fich{T10Def.tex} contains some specific macro used only on page~10.
The files:
  \begin{itemize}
   \item\fich{series2.tex}
   \item\fich{EscherPage10.tex}
   \item\fich{series4.tex}
   \item\fich{stieltjes.tex}
   \item\fich{cramers.tex}
   \item\fich{quote5.tex}
   \item\fich{fib1.tex}
   \item\fich{magic.tex}
  \end{itemize}
contain the mathematic used in the page.

Each mathematical part
is typeset in a parbox top aligned and with a width given in parameter. In fact,
each of these files provides a macro to draw the parbox. This macro can be used
in a \verb+\Block+ command of the package ``nicematrix''.

It is easier to test the command typesetting math outside the environment \verb+NiceTabular+.
To do that, the easiest solution is to comment out all the environment \verb+NiceTabular+ and to
call the macro provided in one of the files by adjusting correctly the width of the text.
An example of code to do that is:
\begin{center}
   \lstinputlisting{ExampleDoc2.tex}
\end{center}

The macro \verb+\AddBlankLines+ used in the environment \verb+NiceTabular+ is used to add
some lines to the nice array (or tabular). 
The command \verb+\Block+ generally does not add space
and the missing lines should be added manually (otherwise a block of more than
one line cannot be drawn).
\section{Using a new font}
    This section has to be written...
\end{document}