1
1
mirror of https://github.com/tonsky/FiraCode.git synced 2024-07-07 09:26:27 +03:00

TeX code markup

Ruixi Zhang 2019-03-23 10:17:58 -04:00
parent 2d2558d22a
commit 6e212fb951

@ -1,9 +1,10 @@
This page is intended for those who wish to use the Fira Code font in the LaTeX *output* files. If you wish to use Fira Code to display your LaTeX source files, then please check whether your LaTeX editor supports Fira Code or not.
This page is intended for those who wish to use the Fira Code fonts in the LaTeX *output* files. If you wish to use Fira Code to display your LaTeX source files, then please check whether your LaTeX editor supports Fira Code or not.
## Activate ligatures in `lstlisting`
The [`lstfiracode`](https://www.ctan.org/pkg/lstfiracode) package defines `FiraCodeStyle` for the use with the [`listings`](https://www.ctan.org/pkg/listings) package. Here is a sample LaTeX document:
The [`lstfiracode`](https://ctan.org/pkg/lstfiracode) package defines `FiraCodeStyle` for the use with the [`listings`](https://ctan.org/pkg/listings) package. Here is a sample LaTeX document:
```tex
% !TeX program = XeLaTeX or LuaLaTeX
% !TeX encoding = UTF-8 Unicode
\documentclass{article}
@ -12,7 +13,7 @@ The [`lstfiracode`](https://www.ctan.org/pkg/lstfiracode) package defines `FiraC
Contextuals=Alternate % Activate the calt feature
]
\usepackage{listings}
\usepackage{lstfiracode} % https://www.ctan.org/pkg/lstfiracode
\usepackage{lstfiracode} % https://ctan.org/pkg/lstfiracode
\lstset{
language=C++,
style=FiraCodeStyle, % Use predefined FiraCodeStyle
@ -27,11 +28,13 @@ The [`lstfiracode`](https://www.ctan.org/pkg/lstfiracode) package defines `FiraC
}
\end{lstlisting}
\end{document}
```
## Activate ligatures in `verbatim`
The [`lstfiracode`](https://www.ctan.org/pkg/lstfiracode) package also supports the `verbatim` environment. Here is a sample LaTeX document:
The [`lstfiracode`](https://ctan.org/pkg/lstfiracode) package also supports the `verbatim` environment. Here is a sample LaTeX document:
```tex
% !TeX program = XeLaTeX or LuaLaTeX
% !TeX encoding = UTF-8 Unicode
\documentclass{article}
@ -40,16 +43,18 @@ The [`lstfiracode`](https://www.ctan.org/pkg/lstfiracode) package also supports
Contextuals=Alternate % Activate the calt feature
]
\usepackage{listings}
\usepackage{lstfiracode} % https://www.ctan.org/pkg/lstfiracode
\usepackage{lstfiracode} % https://ctan.org/pkg/lstfiracode
\begin{document}
\ActivateVerbatimLigatures
\begin{verbatim}
A<-www>>=B
\end{verbatim}
\end{document}
```
If you do not want to load the `lstfiracode` package, here is another solution:
If you do not wish to load the `lstfiracode` package, here is another solution:
```tex
% !TeX program = XeLaTeX or LuaLaTeX
% !TeX encoding = UTF-8 Unicode
\documentclass{article}
@ -65,3 +70,4 @@ If you do not want to load the `lstfiracode` package, here is another solution:
A<-www>>=B
\end{verbatim}
\end{document}
```