🎨 Use Fira Code for listings

main
Adrien Burgun 2 years ago
parent fb09786b82
commit 31a45ab926

@ -1,5 +1,5 @@
\begin{figure} \begin{figure}
\begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}, breaklines=true, basicstyle=\small] \begin{lstlisting}[language=hbs, numbers=none]
{{#>mint.main}} {{#>mint.main}}
{{#>mint.title}} {{#>mint.title}}
Bienvenue [[surname]] [[name]] Bienvenue [[surname]] [[name]]

@ -1,5 +1,5 @@
\begin{figure} \begin{figure}
\begin{lstlisting}[language=xml, numbers=none, backgroundcolor=\color{bgColor}, breaklines=true, basicstyle=\small, showstringspaces=false] \begin{lstlisting}[language=xml, numbers=none]
<mjml> <mjml>
<mj-head> <mj-head>
<!-- ... --> <!-- ... -->

@ -10,7 +10,7 @@
\end{subfigure} \end{subfigure}
\begin{subfigure}[t]{\textwidth} \begin{subfigure}[t]{\textwidth}
\begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}, breaklines=true, basicstyle=\small] \begin{lstlisting}[language=hbs, numbers=none]
Bienvenue Paul Durant Bienvenue Paul Durant
Nous sommes heureux de vous accompagner lors de votre séjour en vous proposant du divertissement. Nous sommes heureux de vous accompagner lors de votre séjour en vous proposant du divertissement.

@ -1,6 +1,6 @@
\begin{figure} \begin{figure}
\begin{subfigure}[t]{\textwidth} \begin{subfigure}[t]{\textwidth}
\begin{lstlisting}[style=JavaScript] \begin{lstlisting}[language=JavaScript]
function useCategoryCache() { function useCategoryCache() {
const [cache, setCache] = React.useState<Record<string, Category>>({}); const [cache, setCache] = React.useState<Record<string, Category>>({});
@ -47,12 +47,12 @@ const Page = (props) => {
\begin{subfigure}[t]{0.45\textwidth} \begin{subfigure}[t]{0.45\textwidth}
\includegraphics[width=\textwidth]{fromeffectloop} \includegraphics[width=\textwidth]{fromeffectloop}
\caption{Les flèches correspondent à un appel, les points à une dépendance} \caption{Schéma des dépendances et des appels: une flèche correspond à un appel, un point à une dépendance}
\end{subfigure} \end{subfigure}
\hfill \hfill
\begin{subfigure}[t]{0.45\textwidth} \begin{subfigure}[t]{0.45\textwidth}
\includegraphics[width=0.3\textwidth]{fromeffectloop2} \includegraphics[width=\textwidth]{fromeffectloop2}
\caption{TODO} \caption{\og Flame graph \fg abstrait des appels}
\end{subfigure} \end{subfigure}
\caption{Version simplifiée du bug causant plusieures requêtes à être executées} \caption{Version simplifiée du bug causant plusieures requêtes à être executées}
\label{fromeffectloop} \label{fromeffectloop}

@ -1,27 +1,27 @@
\begin{figure}[H] \begin{figure}[H]
\begin{subfigure}[t]{0.45\textwidth} \begin{subfigure}[t]{0.45\textwidth}
\begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}] \begin{lstlisting}[language=hbs, numbers=none]
<div> <div>
\end{lstlisting} \end{lstlisting}
\caption{Composant \entity{Mustache} \og \texttt{component\_start} \fg} \caption{Composant \entity{Mustache} \og \texttt{component\_start} \fg}
\end{subfigure} \end{subfigure}
\hfill \hfill
\begin{subfigure}[t]{0.45\textwidth} \begin{subfigure}[t]{0.45\textwidth}
\begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}] \begin{lstlisting}[language=hbs, numbers=none]
<div>{{@partial-block}}</div> <div>{{@partial-block}}</div>
\end{lstlisting} \end{lstlisting}
\caption{Composant \entity{Handlebars} \og \texttt{component} \fg} \caption{Composant \entity{Handlebars} \og \texttt{component} \fg}
\end{subfigure} \end{subfigure}
\begin{subfigure}[t]{0.45\textwidth} \begin{subfigure}[t]{0.45\textwidth}
\begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}] \begin{lstlisting}[language=hbs, numbers=none]
</div> </div>
\end{lstlisting} \end{lstlisting}
\caption{Composant \entity{Mustache} \og \texttt{component\_end} \fg} \caption{Composant \entity{Mustache} \og \texttt{component\_end} \fg}
\end{subfigure} \end{subfigure}
\begin{subfigure}[t]{0.45\textwidth} \begin{subfigure}[t]{0.45\textwidth}
\begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}] \begin{lstlisting}[language=hbs, numbers=none]
{{>component_start}} {{>component_start}}
<p>Hello, world!</p> <p>Hello, world!</p>
{{>component_end}} {{>component_end}}
@ -30,7 +30,7 @@
\end{subfigure} \end{subfigure}
\hfill \hfill
\begin{subfigure}[t]{0.45\textwidth} \begin{subfigure}[t]{0.45\textwidth}
\begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}] \begin{lstlisting}[language=hbs, numbers=none]
{{#>component}} {{#>component}}
<p>Hello, world!</p> <p>Hello, world!</p>
{{/component}} {{/component}}

@ -5,7 +5,7 @@
\end{figure} \end{figure}
\begin{figure}[H] \begin{figure}[H]
\begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}] \begin{lstlisting}[language=hbs, numbers=none]
Hello, user! Hello, user!
This is an automated email sent to you, This is an automated email sent to you,

@ -1,17 +1,17 @@
\begin{figure}[H] \begin{figure}[H]
\begin{lstlisting}[style=JavaScript] \begin{lstlisting}[language=JavaScript]
export abstract class IChildService { export abstract class IChildService {
// ... // ...
} }
@Injectable(IChildService) @Injectable(IChildService)
export class ChildService implements IChildService { export class ChildService implements IChildService {
// ... // ...
} }
@Injectable() @Injectable()
export class ParentService { export class ParentService {
private childService: IChildService; private childService: IChildService;
constructor( constructor(
@ -21,9 +21,9 @@
} }
// ... // ...
} }
@Module({ @Module({
providers: [ providers: [
ChildService, ChildService,
ParentService ParentService
@ -31,8 +31,8 @@
exports: [ exports: [
ParentService ParentService
] ]
}) })
export class ParentModule {} export class ParentModule {}
\end{lstlisting} \end{lstlisting}
\centering \centering

@ -1,15 +1,15 @@
\begin{figure}[H] \begin{figure}[H]
\begin{lstlisting}[style=JavaScript] \begin{lstlisting}[language=JavaScript]
@Injectable() @Injectable()
export class MyService { export class MyService {
constructor( constructor(
parentService: ParentService parentService: ParentService
) { ) {
// ... // ...
} }
} }
@Module({ @Module({
imports: [ imports: [
// Comme ParentModule exporte ParentService, // Comme ParentModule exporte ParentService,
// ce service est facilement rendu disponible ici pour MyService: // ce service est facilement rendu disponible ici pour MyService:
@ -18,8 +18,8 @@
providers: [ providers: [
MyService MyService
] ]
}) })
export class MyModule {} export class MyModule {}
\end{lstlisting} \end{lstlisting}
\centering \centering

Binary file not shown.

@ -5,11 +5,13 @@
\usepackage[T1]{fontenc} \usepackage[T1]{fontenc}
\usepackage[a4paper, margin=0.7in]{geometry} \usepackage[a4paper, margin=0.7in]{geometry}
\usepackage[french]{babel} \usepackage[french]{babel}
\usepackage{xspace} % From https://tex.stackexchange.com/questions/150640/missing-space-after-guillemets
\usepackage{amsmath} \usepackage{amsmath}
\usepackage{amsfonts} \usepackage{amsfonts}
\usepackage{mathtools} \usepackage{mathtools}
\usepackage{mathabx} \usepackage{mathabx}
\usepackage{listings} \usepackage{listings}
\usepackage[many]{tcolorbox}
\usepackage{xcolor} \usepackage{xcolor}
\usepackage{float} \usepackage{float}
\usepackage{cite} \usepackage{cite}
@ -32,11 +34,27 @@
% Requires xelatex to run (or maybe also lualatex) % Requires xelatex to run (or maybe also lualatex)
\usepackage{utbmcovers} \usepackage{utbmcovers}
\setmonofont[Contextuals={Alternate}]{Fira Code}
\newfontfamily{\FiraCode}[Contextuals={Alternate}]{Fira Code}
\IfFontExistsTF{Fira Code SemiBold}{
\newfontfamily{\FiraCodeSB}[UprightFont={* SemiBold}]{Fira Code}
}{
\IfFontExistsTF{Fira Code Semi-Bold}{
\newfontfamily{\FiraCodeSB}[UprightFont={* Semi-Bold}]{Fira Code}
}{
\newfontfamily{\FiraCodeSB}[UprightFont={* Semibold}]{Fira Code}
}
}
\definecolor{kwColor}{rgb}{0.15,0.21,0.87}
% From https://tex.stackexchange.com/questions/89574/language-option-supported-in-listings % From https://tex.stackexchange.com/questions/89574/language-option-supported-in-listings
\lstdefinelanguage{JavaScript}{ \lstdefinelanguage{JavaScript}{
keywords={ keywords={
typeof, new, typeof, new,
abstract, class, interface, type, function, return, abstract, class, interface, type, function, return,
async, await,
try, catch, finally, try, catch, finally,
switch, case, break, switch, case, break,
var, let, const, var, let, const,
@ -44,13 +62,13 @@
for, while, in, of, do, for, while, in, of, do,
true, false, null, undefined true, false, null, undefined
}, },
keywordstyle=\color{blue}\bfseries, keywordstyle=\color{kwColor}\FiraCodeSB,
ndkeywords={ ndkeywords={
export, implements, import, this, export, implements, import, this,
private, public, readonly, constructor, private, public, readonly, constructor,
@Inject, @Injectable, @Controller, @Module @Inject, @Injectable, @Controller, @Module
}, },
ndkeywordstyle=\color{darkgray}\bfseries, ndkeywordstyle=\color{darkgray}\FiraCodeSB,
identifierstyle=\color{black}, identifierstyle=\color{black},
sensitive=false, sensitive=false,
comment=[l]{//}, comment=[l]{//},
@ -62,15 +80,16 @@
} }
\lstdefinelanguage{hbs}{ \lstdefinelanguage{hbs}{
morecomment=[s]{\{\{!}{!\}\}}, % morecomment=[s]{\{\{!}{!\}\}},
morecomment=[s]{<!--}{-->},
commentstyle=\color{purple}\ttfamily, commentstyle=\color{purple}\ttfamily,
stringstyle=\color{red}\ttfamily, stringstyle=\color{red}\ttfamily,
morestring=[s]{\{\{}{\}\}}, morestring=[s]{\{\{}{\}\}},
} }
\definecolor{bgColor}{rgb}{0.95,0.94,0.92} \definecolor{bgColor}{rgb}{0.95,0.94,0.92}
\lstdefinestyle{JavaScript}{ \lstset{
backgroundcolor=\color{bgColor}, % backgroundcolor=\color{bgColor},
commentstyle=\color{gray}, commentstyle=\color{gray},
keywordstyle=\color{magenta}, keywordstyle=\color{magenta},
numberstyle=\tiny\color{gray}, numberstyle=\tiny\color{gray},
@ -86,7 +105,13 @@
showstringspaces=false, showstringspaces=false,
showtabs=false, showtabs=false,
tabsize=2, tabsize=2,
language=JavaScript }
\tcolorboxenvironment{lstlisting}{
spartan,
frame empty,
boxsep=0mm,
left=1mm,right=1mm,top=-1mm,bottom=-1mm,
colback=bgColor,
} }
\graphicspath{{build/figures/}{images/}} \graphicspath{{build/figures/}{images/}}

Loading…
Cancel
Save