Skip to content

Commit

Permalink
- english documentation added
Browse files Browse the repository at this point in the history
  • Loading branch information
franckgaga committed Mar 26, 2020
1 parent a5fd061 commit 3b9f8ff
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ sample_glosnomtools.pdf
sample_glosmathtools.pdf
glosmathtools.tar.gz
ctanify_glosmathtools.sh
sample_glosmathtools_fr.pdf
sample_glosmathtools_en.pdf
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ The main features are:
- bilangual nomenclatures (for bilangual documents)
- bilangual abbreviations

At the time being, the documentation is based on `ulthese` class and
in french only.
The documentation is based on `ulthese` class.

## Licence

Expand All @@ -23,7 +22,7 @@ later version.

## Version

0.5.2 (2020-03-20)
1.0.0 (2020-03-26)

## Author

Expand Down
2 changes: 1 addition & 1 deletion glosmathtools.sty
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glosmathtools}%
[%
2020/03/20 v0.5.2 %
2020/03/26 v1.0.0 %
Mathematical nomenclature tools based on glossaries package %
Francis Gagnon %
]%
Expand Down
112 changes: 112 additions & 0 deletions sample_glosmathtools_en.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
% !TeX encoding = UTF-8
% !TeX spellcheck = en_US
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Main document for glosmathtool sample
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% manually load hyperref with nohyperref
\documentclass[projet,nohyperref,article,english,french]{ulthese}
%% ===================== packages ============================================
\ifxetex\else \usepackage[utf8]{inputenc} \fi
\usepackage{mathtools,siunitx,amsmath,amsfonts}
\usepackage{hyperref} % loaded last except glosmathtools
% toc ocption passed to glossaries : add nomenclature to PDF bookmarks
\usepackage[qtmarkupright,singlelineskip,toc]{glosmathtools}
%% ===================== preamble ============================================
%% ------------- glosmathtools -----------------------------------------------
\makeglossaries% executed in first
\setacronymlang{L1}% first language abbreviations
\setglossarystyle{nomencl-L1L2}% bilingual description
\loadglsentries{sample_glosmathtools_glos} % definition file
\glssetwidest{LOOP} % IMPORTANT : widest entry in nomenclature
\renewcommand*{\glscatnamefmt}[1]{\textbf{#1}} % category text format
%% ------------- ulthese ----------------------------------------------------
\titre{\texttt{glosmathtools} documentation and sample in \texttt{ulthese}}
\soustitre{v1.0.0}
\auteur{Francis Gagnon}
\makeatletter\renewcommand*{\UL@typeofdoc}{}\makeatother
%% ============================================================================

\begin{document}
\selectlanguage{english} % babel-related (not glosmathtool)
\frontmatter
\frontispice

\printglossary[title=Nomenclature]

\mainmatter

\chapter{\texttt{glosmathtools} documentation and sample}

\section{Compilation}
The \texttt{glosmathtools} package is based on \texttt{glossaries} included in MiKTeX and TeX Live. Like a bibliography, the glossary compilation is done by executing the commands in the following order:
\begin{enumerate}
\item \texttt{pdflatex}
\item \texttt{makeglossaries}
\item \texttt{pdflatex}
\end{enumerate}
The \texttt{makeglossaries} command is directly available in TeXstudio menus or with \texttt{F9}. For other editors, add a custom command. For example, in TexMaker, go to \texttt{User > User Commands > Edit User Commands}:
\begin{itemize}
\item Menu Item : \texttt{glossaries}
\item Command : \texttt{makeglossaries \%}
\end{itemize}
On Windows with MiKTeX, the \texttt{makeglossaries} script may requires an installation of Perl (see \url{https://tinyurl.com/ybnoyqjp}). Once Perl installed, you should run \texttt{perltex.exe} available in the MiKTeX installation directory.

\section{Package options}
The options of the \texttt{glosmathtools} package are summarized by:
\begin{description}
\item[qtmarkupright] character \texttt{<">} shortcut for subscript without italics
\item[singlelineskip] force single line spacing in nomenclature
\item[nodefop] use operators and accents without definitions
\item[{[other options]}] passed to \texttt{glossaries} package
\end{description}
For example, the \textbf{toc} option of \texttt{glossaries} can be added to include the nomenclature in the table of contents.
\section{Using the package}
By default, mathematical symbols must be used in the text so that they are added to the nomenclature, which encourages the author to introduce his variables. It is still possible to manually add a symbol without referring to it with the \texttt{\textbackslash glsadd\{label\}} macro, or \texttt{\textbackslash glsaddall}, to add everything.
\subsection{Symbols, subscripts and accents}
The insertion of a simple mathematical symbol with hyperlink is done with the \texttt{\textbackslash gls} macro of \texttt{glossaries}: \gls{k}, \gls{mat.A} and \gls{mat.b}. The same goes for abbreviations: the \gls{ODE}. Abbreviations are only defined at their first use: the \gls{ODE}.
Subscripts must be labeled \texttt{sub.restOfTheLabel}: the subscript \gls{sub.a} indicates air. The \texttt{\textbackslash glsub} macro allows to add subscripts to variables: \glsub{d}{v}, \glsub{z}{v}, \glsub{T}{v}, \glsub{D}{a}, \glsub{rho}{w} and \glsub{mu}{v}. By defining mathematical symbols with \texttt{\textbackslash newglosentrymath}, all macros can be used in text mode and math mode (with \texttt{\$\$}). Still, it is better to write explicit symbols in equations to ease code reading (no hyperlink):
\begin{equation}
d"v + \glsub{d}{v} = \SI{10.0}{\centi\meter} = 3.937\qtmark
\end{equation}
The package can be loaded with the \texttt{qtmarkupright} option. The \texttt{<">} character is then configured as a shortcut for writing an index without italics in \texttt{math} mode (\texttt{<\_>} for italic index) \footnote{The \texttt{\textbackslash qtmark} macro inserts the character <">. In ISO, subscripts representing the abbreviation of a word are written without italics, and those representing a variable, in italics.}.
The \texttt{\textbackslash glsvi} macro appends a variable in index to another variable, and \texttt{\textbackslash glsvisub}, an indexed variable to another variable: \glsvi{T}{k} and \glsvisub{T}{z}{v}. Finally, it is possible to add two subscripts separated by comma with \texttt{\textbackslash glsubs}: \glsubs{D}{w}{a}. In this case, the comma operator is added to the nomenclature, which must be defined in the glossary under \texttt{op.comma} label.
Accents can also be added to variables with \texttt{\textbackslash glsac} macro: \glsac[dot]{m} and \glsac[bar]{T}. At their respective use, an operator is added to the nomenclature. They must therefore be defined at their respective labels. The available accents are:
\begin{description}
\item[dot] $\dot{\bullet}$ (defined at label \texttt{op.dot})
\item[ddot] $\ddot{\bullet}$ (defined at label \texttt{op.ddot})
\item[bar] $\bar{\bullet}$ (defined at label \texttt{op.bar})
\item[hat] $\widehat{\bullet}$ (defined at label \texttt{op.hat})
\item[vec] $\vec{\bullet}$ (defined at label \texttt{op.vec})
\item[tilde] $\widetilde{\bullet}$ (defined at label \texttt{op.tilde})
\end{description}
Moreover, an optional argument makes it possible to add accents to all the aforementioned macros: \glsub[bar]{T}{v} and \glsubs[dot]{m}{v}{a}. There are two optional arguments for \texttt{\textbackslash glsvi} and \texttt{\textbackslash glsvisub} cases: \glsvi[dot]{m}{k}, \glsvi[bar][dot]{T}{m} and \glsvisub[][dot]{T}{m}{w}. Finally, the \texttt{nodefop} option makes it possible to use accents without nomenclature definitions.
\subsection{Language, abbreviations and nomenclature}
If there are language changes throughout the document, you must change the language for acronyms. The \texttt{descseclang} key must be defined in the glossary beforehand. Afterward, the \texttt{\textbackslash setacronymlang} macro allows to choose among 4 language options:
\begin{description}
\item[L1] main language description (abbreviation) : \setacronymlang{L1}\acrfull{TL}
\item[L2] second language description (abbreviation) : \setacronymlang{L2}\acrfull{TL}
\item[L1L2] bilingual description, main language (abbreviation, \textit{second language}) : \setacronymlang{L1L2}\acrfull{TL}
\item[L2L1] bilingual description, second language (abbreviation, \textit{main language}) : \setacronymlang{L2L1}\acrfull{TL}
\end{description}
\setacronymlang{L1}% back to document language
The \texttt{acronymlang} environment works in a similar way: \begin{acronymlang}{L1L2}\acrfull{TL}\end{acronymlang}. The \texttt{\textbackslash glslang} macro displays the acronym in the specified language: \glslang[L1L2]{TL}. Second descriptions are also available with \texttt{\textbackslash glsdescsec}: \textit{le \glsdescsec{TL}}.
For the nomenclature (or list of symbols), the widest entry must be defined in the preamble with \texttt{\textbackslash glssetwidest}. Like abbreviations, it is possible to change your language with 4 style options for \texttt{\textbackslash setglossarystyle}:
\begin{description}
\item[nomencl-L1] (or \textbf{nomencl}) main language description
\item[nomencl-L2] second language description
\item[nomencl-L1L2] bilingual description, main language (abbreviation, \textit{second language})
\item[nomencl-L2L1] bilingual description, second language (abbreviation, \textit{main language})
\end{description}
The \texttt{singlespaceglos} package option forces single line spacing in the nomenclature (requires \texttt{ulthese}/\texttt{memoir} or the \texttt{setspace} package). The \texttt{\textbackslash glscatnamefmt} macro can be redefined in the preamble to modify header format for categories. The example on page ii is a bilingual nomenclature \textbf{nomencl-L2L1} with single line spacing.
If defined, the content of \texttt{symbol} key is appended to descriptions (for units or dimensions). Note that the mathematical symbols are not saved in this key, but at the \texttt{name} key.
\end{document}
17 changes: 9 additions & 8 deletions sample_glosmathtools.tex → sample_glosmathtools_fr.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% nohyperref pour charger le package hyperref manuellement
% voir https://gitlab.com/vigou3/ulthese/issues/2
\documentclass[projet,nohyperref,english,french]{ulthese}
\documentclass[projet,nohyperref,article,english,french]{ulthese}
%% ===================== packages ============================================
\ifxetex\else \usepackage[utf8]{inputenc} \fi
\usepackage{mathtools,siunitx,amsmath,amsfonts}
Expand All @@ -23,14 +22,16 @@
\renewcommand*{\glscatnamefmt}[1]{\textbf{#1}} % format des catégories
%% ------------- ulthese ----------------------------------------------------
\titre{Documentation et exemple de \texttt{glosmathtools} dans \texttt{ulthese}}
\soustitre{v0.5.2}
\soustitre{v1.0.0}
\auteur{Francis Gagnon}
\makeatletter\renewcommand*{\UL@typeofdoc}{}\makeatother
%% ============================================================================

\begin{document}
\frontmatter
\selectlanguage{french} % pour babel (pas glosmathtool)
\frontmatter
\frontispice

\printglossary[title=Nomenclature]

\mainmatter
Expand Down Expand Up @@ -62,9 +63,10 @@ \section{Options du package}
Par exemple, l'option \textbf{toc} du package \texttt{glossaries} peut être ajouté afin d'inclure la nomenclature dans la table des matières.
\section{Utilisation du package}
\subsection{Symboles, indices et accentuations}
Par défaut, les symboles mathématiques doivent être utilisés dans le texte pour qu'ils soient ajoutés à la nomenclature, ce qui incite l'auteur à introduire ses variables. Il est tout de même possible de manuellement ajouter un symbole sans y référer avec la macro \texttt{\textbackslash glsadd\{label\}}, ou \texttt{\textbackslash glsaddall}, pour tout ajouter.
L'insertion d'un symbole mathématique simple avec hyperlien se fait avec la macro \texttt{\textbackslash gls} de \texttt{glossaries} : \gls{k}, \gls{mat.A} et \gls{mat.b}. C'est la même chose pour les abréviations : le \gls{LOOP}. Les abréviations sont uniquement définies à leur première utilisation : le \gls{LOOP}.
\subsection{Symboles, indices et accentuations}
L'insertion d'un symbole mathématique simple avec hyperlien se fait avec la macro \texttt{\textbackslash gls} de \texttt{glossaries} : \gls{k}, \gls{mat.A} et \gls{mat.b}. C'est la même chose pour les abréviations : la \gls{TL}. Les abréviations sont uniquement définies à leur première utilisation : la \gls{TL}.
Les indices doivent être définis avec un label du format \texttt{sub.resteDuLabel}: l'indice \gls{sub.a} désigne l'air. La macro \texttt{\textbackslash glsub} permet d'ajouter un indice à une variable : \glsub{d}{v}, \glsub{z}{v}, \glsub{T}{v}, \glsub{D}{a}, \glsub{rho}{w} et \glsub{mu}{v}. En définissant les symboles mathématiques avec \texttt{\textbackslash newglosentrymath}, toutes les macros peuvent s'utiliser autant en mode \texttt{text} qu'en mode \texttt{math} (avec \texttt{\$\$}). Par contre, il est mieux d'écrire explicitement les symboles dans une équation afin d'alléger le code (pas d'hyperlien):
\begin{equation}
Expand All @@ -86,7 +88,6 @@ \subsection{Symboles, indices et accentuations}
De plus, un argument optionnel permet d'ajouter des accents à toutes les macros précédentes : \glsub[bar]{T}{v} et \glsubs[dot]{m}{v}{a}. Il y a deux arguments optionnels dans le cas de \texttt{\textbackslash glsvi} et \texttt{\textbackslash glsvisub} : \glsvi[dot]{m}{k}, \glsvi[bar][dot]{T}{m} et \glsvisub[][dot]{T}{m}{w}. Finalement, il est possible d'utiliser les accents sans définition dans la nomenclature avec l'option \texttt{nodefop}.
\subsection{Langue, abréviations et nomenclature}
S'il y a des changements de langues à travers le document, il faut changer de langue pour les acronymes. La clé \texttt{descseclang} doit être préalablement définie dans le glossaire. Par la suite, la macro \texttt{\textbackslash setacronymlang} permet de choisir 4 options de langue:
\begin{description}
\item[L1] description langue principale (abréviations) : \setacronymlang{L1}\acrfull{ODE}
Expand Down
4 changes: 2 additions & 2 deletions sample_glosmathtools_glos.tex
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
parent=abbrv%
]{ODE}{ODE}{ordinary differential equation}
\newacronym[%
descseclang={laboratoire d'observation et d'optimisation des procédés},%
descseclang={transformation de Laplace},%
parent=abbrv%
]{LOOP}{LOOP}{process observation and optimization laboratory}
]{TL}{TL}{Laplace transform}
}%

0 comments on commit 3b9f8ff

Please sign in to comment.