| 1 |
% !TeX TXS-program:compile = txs:///arara |
| 2 |
% arara: lualatex: {shell: no, synctex: no, interaction: batchmode} |
| 3 |
|
| 4 |
\documentclass{article} |
| 5 |
\usepackage[margin=0.5in]{geometry} |
| 6 |
\usepackage{jetbrainsmono-otf} |
| 7 |
\usepackage{listings} |
| 8 |
\usepackage{xcolor} |
| 9 |
\setlength{\parindent}{0pt} |
| 10 |
|
| 11 |
\newcommand\demotext{For \textsterling 45, almost anything can be found floating in fields.\\ |
| 12 |
!`THE DAZED BROWN FOX QUICKLY GAVE 12345--67890 JUMPS!\\ |
| 13 |
--- ?`But aren't Kafka's Schlo\ss{} and \AE sop's \OE uvres often na\"\i ve vis-\`a-vis the d\ae monic ph\oe nix's official r\^ole in fluffy souffl\'es? |
| 14 |
} |
| 15 |
|
| 16 |
\newcommand\samplettxt{oO08 iIlL1 g9qCGQ <=>} |
| 17 |
\newcommand\samplett[1][]{#1\samplettxt} |
| 18 |
\newcommand\samplettit[1][]{\textit{#1\samplettxt}} |
| 19 |
\newcommand\samplettbf[1][]{\textbf{#1\samplettxt}} |
| 20 |
\newcommand\samplettbfit[1][]{\textbf{\textit{#1\samplettxt}}} |
| 21 |
\newcommand\sampletttbl[1][]{& \samplett[#1] & \samplettit[#1] & \samplettbf[#1] & \samplettbfit[#1]} |
| 22 |
|
| 23 |
\begin{document} |
| 24 |
|
| 25 |
\part*{jetbrainsmono-otf (v0.1)} |
| 26 |
|
| 27 |
\section{Usages} |
| 28 |
|
| 29 |
With \lstinline[language={[latex]TeX},basicstyle=\ttfamily]|\usepackage{fontspec}| (so with \lstinline[language={[latex]TeX},basicstyle=\ttfamily]|XeTeX| or \lstinline[language={[latex]TeX},basicstyle=\ttfamily]|LuaLaTeX| compilation), you can use \texttt{JetBrainsMono} fonts, and (if needed) \textit{remove} ligature's features, in order to use (in fact) \texttt{JetBrainsMonoNL} fonts. Following \textsf{OpenType} fonts are supported : |
| 30 |
|
| 31 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 32 |
JetBrainsMono-Bold.otf JetBrainsMono-BoldItalic.otf |
| 33 |
JetBrainsMono-ExtraBold.otf JetBrainsMono-ExtraBoldItalic.otf |
| 34 |
JetBrainsMono-ExtraLight.otf JetBrainsMono-ExtraLightItalic.otf |
| 35 |
JetBrainsMono-Italic.otf JetBrainsMono-Light.otf |
| 36 |
JetBrainsMono-LightItalic.otf JetBrainsMono-Medium.otf |
| 37 |
JetBrainsMono-MediumItalic.otf JetBrainsMono-Regular.otf |
| 38 |
JetBrainsMono-SemiBold.otf JetBrainsMono-SemiBoldItalic.otf |
| 39 |
JetBrainsMono-Thin.otf JetBrainsMono-ThinItalic.otf |
| 40 |
\end{lstlisting} |
| 41 |
|
| 42 |
Two version of config/macro are available : |
| 43 |
|
| 44 |
\begin{tabular}{l} |
| 45 |
~~~\lstinline[language={[latex]TeX},basicstyle=\ttfamily]|jetbrainsmono(-xxxx)| or \lstinline[language={[latex]TeX},basicstyle=\ttfamily]|jetbrainscode(-xxxx)| |
| 46 |
\\ |
| 47 |
~~~\lstinline[language={[latex]TeX},basicstyle=\ttfamily]|\jetbrainsmono(xxxx)| or \lstinline[language={[latex]TeX},basicstyle=\ttfamily]|\jetbrainscode(xxxx)| \\ |
| 48 |
\end{tabular} |
| 49 |
|
| 50 |
\section{The default settings} |
| 51 |
|
| 52 |
The \texttt{fontspec} config for the \textit{normal} version : |
| 53 |
|
| 54 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 55 |
\defaultfontfeatures[jetbrainsmono] % or jetbrainscode |
| 56 |
{Extension=.otf, |
| 57 |
UprightFont=JetBrainsMono-Regular, |
| 58 |
ItalicFont=JetBrainsMono-Italic, |
| 59 |
BoldFont=JetBrainsMono-Bold, |
| 60 |
BoldItalicFont=JetBrainsMono-BoldItalic, |
| 61 |
Contextuals=AlternateOff %for mono version |
| 62 |
} |
| 63 |
\end{lstlisting} |
| 64 |
|
| 65 |
The \texttt{fontspec} config for the other versions are : |
| 66 |
|
| 67 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 68 |
\defaultfontfeatures[jetbrainsmono-medium] % or jetbrainscode-medium |
| 69 |
{Extension=.otf, |
| 70 |
UprightFont=JetBrainsMono-Medium, |
| 71 |
ItalicFont=JetBrainsMono-MediumItalic, |
| 72 |
BoldFont=JetBrainsMono-ExtraBold, |
| 73 |
BoldItalicFont=JetBrainsMono-ExtraBoldItalic, |
| 74 |
Contextuals=AlternateOff %for mono version |
| 75 |
} |
| 76 |
\end{lstlisting} |
| 77 |
|
| 78 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 79 |
\defaultfontfeatures[jetbrainsmono-light] % or jetbrainscode-light |
| 80 |
{Extension=.otf, |
| 81 |
UprightFont=JetBrainsMono-Light, |
| 82 |
ItalicFont=JetBrainsMono-LightItalic, |
| 83 |
BoldFont=JetBrainsMono-SemiBold, |
| 84 |
BoldItalicFont=JetBrainsMono-SemiBoldItalic, |
| 85 |
Contextuals=AlternateOff %for mono version |
| 86 |
} |
| 87 |
\end{lstlisting} |
| 88 |
|
| 89 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 90 |
\defaultfontfeatures[jetbrainsmono-extralight] % or jetbrainscode-extralight |
| 91 |
{Extension=.otf, |
| 92 |
UprightFont=JetBrainsMono-ExtraLight, |
| 93 |
ItalicFont=JetBrainsMono-ExtraLightItalic, |
| 94 |
BoldFont=JetBrainsMono-Medium, |
| 95 |
BoldItalicFont=JetBrainsMono-MediumItalic, |
| 96 |
Contextuals=AlternateOff %for mono version |
| 97 |
} |
| 98 |
\end{lstlisting} |
| 99 |
|
| 100 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 101 |
\defaultfontfeatures[jetbrainsmono-thin] % or jetbrainscode-thin |
| 102 |
{Extension=.otf, |
| 103 |
UprightFont=JetBrainsMono-Thin, |
| 104 |
ItalicFont=JetBrainsMono-ThinItalic, |
| 105 |
BoldFont=JetBrainsMono-Regular, |
| 106 |
BoldItalicFont=JetBrainsMono-Italic, |
| 107 |
Contextuals=AlternateOff %for mono version |
| 108 |
} |
| 109 |
\end{lstlisting} |
| 110 |
|
| 111 |
\subsection{With config files} |
| 112 |
|
| 113 |
The idea is to propose \texttt{fontspec} config files to load correctly \texttt{JetBrainsMono} features. |
| 114 |
|
| 115 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 116 |
\usepackage{fontspec} |
| 117 |
\setmonofont{jetbrainsmono}[options] %version regular |
| 118 |
\setmonofont{jetbrainsmono-medium}[options] %version semilight |
| 119 |
\setmonofont{jetbrainsmono-light}[options] %version light |
| 120 |
\setmonofont{jetbrainsmono-extralight}[options] %version extralight |
| 121 |
\setmonofont{jetbrainsmono-thin}[options] %version thin |
| 122 |
\end{lstlisting} |
| 123 |
|
| 124 |
\subsection{With the package loading} |
| 125 |
|
| 126 |
With \lstinline[language={[latex]TeX},basicstyle=\ttfamily]|\usepackage[scale=...]{jetbrainsmono-oft}|, \lstinline[language={[latex]TeX},basicstyle=\ttfamily]|fontspec| is loaded, and \lstinline[language={[latex]TeX},basicstyle=\ttfamily]|fontfamily| are defined : |
| 127 |
|
| 128 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 129 |
\newfontfamily\jetbrainsmono{jetbrainsmono} |
| 130 |
\newfontfamily\jetbrainsmonomedium{jetbrainsmono-medium} |
| 131 |
\newfontfamily\jetbrainsmonolight{jetbrainsmono-light} |
| 132 |
\newfontfamily\jetbrainsmonoextralight{jetbrainsmono-extralight} |
| 133 |
\newfontfamily\jetbrainsmonothin{jetbrainsmono-thin} |
| 134 |
\end{lstlisting} |
| 135 |
|
| 136 |
\section{Font Samples} |
| 137 |
|
| 138 |
\subsection{Normal version} |
| 139 |
|
| 140 |
\setmonofont{jetbrainsmono}[Scale=MatchLowercase] |
| 141 |
|
| 142 |
\texttt{\demotext}\par\bigskip |
| 143 |
|
| 144 |
\texttt{\textit{\demotext}}\par\bigskip |
| 145 |
|
| 146 |
\texttt{\textbf{\demotext}}\par\bigskip |
| 147 |
|
| 148 |
\texttt{\textbf{\textit{\demotext}}}\par |
| 149 |
|
| 150 |
\subsection{Medium version} |
| 151 |
|
| 152 |
\setmonofont{JetBrainsMonoMedium}[Scale=MatchLowercase] |
| 153 |
|
| 154 |
\texttt{\demotext}\par\bigskip |
| 155 |
|
| 156 |
\texttt{\itshape\demotext}\par\bigskip |
| 157 |
|
| 158 |
\texttt{\bfseries\demotext}\par\bigskip |
| 159 |
|
| 160 |
\texttt{\bfseries\itshape\demotext}\par |
| 161 |
|
| 162 |
\subsection{Light version (Light - LightItalic - Regular - Italic)} |
| 163 |
|
| 164 |
\setmonofont{jetbrainsmono-light}[Scale=MatchLowercase] |
| 165 |
|
| 166 |
\texttt{\demotext}\par\bigskip |
| 167 |
|
| 168 |
\texttt{\itshape\demotext}\par\bigskip |
| 169 |
|
| 170 |
\texttt{\bfseries\demotext}\par\bigskip |
| 171 |
|
| 172 |
\texttt{\bfseries\itshape\demotext}\par |
| 173 |
|
| 174 |
\subsection{ExtraLight version (ExtraLight - ExtraLightItalic - SemiLightItalic - SemiLightItalic)} |
| 175 |
|
| 176 |
\setmonofont{jetbrainsmono-extralight}[Scale=MatchLowercase] |
| 177 |
|
| 178 |
\texttt{\demotext}\par\bigskip |
| 179 |
|
| 180 |
\texttt{\itshape\demotext}\par\bigskip |
| 181 |
|
| 182 |
\texttt{\bfseries\demotext}\par\bigskip |
| 183 |
|
| 184 |
\texttt{\bfseries\itshape\demotext}\par |
| 185 |
|
| 186 |
\subsection{Thin version} |
| 187 |
|
| 188 |
\setmonofont{jetbrainsmono-thin}[Scale=MatchLowercase] |
| 189 |
|
| 190 |
\texttt{\demotext}\par\bigskip |
| 191 |
|
| 192 |
\texttt{\itshape\demotext}\par\bigskip |
| 193 |
|
| 194 |
\texttt{\bfseries\demotext}\par\bigskip |
| 195 |
|
| 196 |
\texttt{\bfseries\itshape\demotext}\par |
| 197 |
|
| 198 |
\section{Simple code samples} |
| 199 |
|
| 200 |
\setmonofont{CMU Typewriter Text}[Scale=MatchLowercase] |
| 201 |
|
| 202 |
\noindent{\small \begin{tabular}{lllll} |
| 203 |
\hline |
| 204 |
Type & Normal & Italic & Bold & BoldItalic \\ \hline |
| 205 |
ttdefault \sampletttbl[\ttfamily] \\ \hline |
| 206 |
%mono |
| 207 |
JBmono \sampletttbl[\jetbrainsmono] \\ \hline |
| 208 |
JBmonomedium \sampletttbl[\jetbrainsmonomedium] \\ \hline |
| 209 |
JBmonolight \sampletttbl[\jetbrainsmonolight] \\ \hline |
| 210 |
JBmonoextralight \sampletttbl[\jetbrainsmonoextralight] \\ \hline |
| 211 |
JBmonothin \sampletttbl[\jetbrainsmonothin] \\ \hline |
| 212 |
%code |
| 213 |
JBcode \sampletttbl[\jetbrainscode] \\ \hline |
| 214 |
JBcodemedium \sampletttbl[\jetbrainscodemedium] \\ \hline |
| 215 |
JBcodelight \sampletttbl[\jetbrainscodelight] \\ \hline |
| 216 |
JBcodeextralight \sampletttbl[\jetbrainscodeextralight] \\ \hline |
| 217 |
JBcodethin \sampletttbl[\jetbrainscodethin] \\ \hline |
| 218 |
\end{tabular}} |
| 219 |
|
| 220 |
\section{Algorithm samples, without ligatures} |
| 221 |
|
| 222 |
\subsection{Normal version} |
| 223 |
|
| 224 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\jetbrainsmono,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single] |
| 225 |
def Fibonacci(n) : |
| 226 |
# Check if input is 0 then it will print incorrect input |
| 227 |
if n < 0 : |
| 228 |
print("Incorrect input") |
| 229 |
elif n == 0 : |
| 230 |
return 0 |
| 231 |
elif n == 1 or n == 2 : |
| 232 |
return 1 |
| 233 |
else : |
| 234 |
return Fibonacci(n-1) + Fibonacci(n-2) |
| 235 |
\end{lstlisting} |
| 236 |
|
| 237 |
\subsection{Medium version} |
| 238 |
|
| 239 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\jetbrainsmonomedium,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single] |
| 240 |
def Fibonacci(n) : |
| 241 |
# Check if input is 0 then it will print incorrect input |
| 242 |
if n < 0 : |
| 243 |
print("Incorrect input") |
| 244 |
elif n == 0 : |
| 245 |
return 0 |
| 246 |
elif n == 1 or n == 2 : |
| 247 |
return 1 |
| 248 |
else : |
| 249 |
return Fibonacci(n-1) + Fibonacci(n-2) |
| 250 |
\end{lstlisting} |
| 251 |
|
| 252 |
\subsection{Light version} |
| 253 |
|
| 254 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\jetbrainsmonolight,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single] |
| 255 |
def Fibonacci(n) : |
| 256 |
# Check if input is 0 then it will print incorrect input |
| 257 |
if n < 0 : |
| 258 |
print("Incorrect input") |
| 259 |
elif n == 0 : |
| 260 |
return 0 |
| 261 |
elif n == 1 or n == 2 : |
| 262 |
return 1 |
| 263 |
else : |
| 264 |
return Fibonacci(n-1) + Fibonacci(n-2) |
| 265 |
\end{lstlisting} |
| 266 |
|
| 267 |
\subsection{ExtraLight version} |
| 268 |
|
| 269 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\jetbrainsmonoextralight,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single] |
| 270 |
def Fibonacci(n) : |
| 271 |
# Check if input is 0 then it will print incorrect input |
| 272 |
if n < 0 : |
| 273 |
print("Incorrect input") |
| 274 |
elif n == 0 : |
| 275 |
return 0 |
| 276 |
elif n == 1 or n == 2 : |
| 277 |
return 1 |
| 278 |
else : |
| 279 |
return Fibonacci(n-1) + Fibonacci(n-2) |
| 280 |
\end{lstlisting} |
| 281 |
|
| 282 |
\subsection{Thin version} |
| 283 |
|
| 284 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\jetbrainsmonothin,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single] |
| 285 |
def Fibonacci(n) : |
| 286 |
# Check if input is 0 then it will print incorrect input |
| 287 |
if n < 0 : |
| 288 |
print("Incorrect input") |
| 289 |
elif n == 0 : |
| 290 |
return 0 |
| 291 |
elif n == 1 or n == 2 : |
| 292 |
return 1 |
| 293 |
else : |
| 294 |
return Fibonacci(n-1) + Fibonacci(n-2) |
| 295 |
\end{lstlisting} |
| 296 |
|
| 297 |
\pagebreak |
| 298 |
|
| 299 |
\section{Algorithm code, with ligatures} |
| 300 |
|
| 301 |
\setmonofont{CMU Typewriter Text}[Scale=MatchLowercase] |
| 302 |
|
| 303 |
Regular version of the fonts, with ligatures enable, can be uses with \texttt{code} alias (\lstinline[language={[latex]TeX},basicstyle=\ttfamily]|\jetbrainscode|). |
| 304 |
|
| 305 |
\makeatletter |
| 306 |
\renewcommand*\verbatim@nolig@list{} |
| 307 |
\makeatother |
| 308 |
|
| 309 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\jetbrainscode,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single,columns=flexible,showstringspaces=false] |
| 310 |
\lstset{ |
| 311 |
language=python, |
| 312 |
basicstyle=\footnotesize\jetbrainscode, |
| 313 |
commentstyle=\itshape\color{gray}, |
| 314 |
keywordstyle=\bfseries\color{magenta}, |
| 315 |
tabsize=4, |
| 316 |
frame=single, |
| 317 |
columns=flexible, |
| 318 |
showstringspaces=false |
| 319 |
} |
| 320 |
\end{lstlisting} |
| 321 |
|
| 322 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\jetbrainscode,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single,columns=flexible,showstringspaces=false] |
| 323 |
const similar = "oO08 iIlL1 g9qCGQ" |
| 324 |
const diacritics_etc = "â é ù ï ø ç Ã Ē Æ œ" |
| 325 |
|
| 326 |
window.toggleFavorite = (alias) => { |
| 327 |
try { |
| 328 |
let favorites = JSON.parse(localStorage.getItem('favorites')) || [] |
| 329 |
if (favorites.indexOf(alias) > -1) { |
| 330 |
favorites = favorites.filter((v) => { |
| 331 |
return v !== alias |
| 332 |
}) |
| 333 |
} else { |
| 334 |
favorites.push(alias) |
| 335 |
} |
| 336 |
localStorage.setItem('favorites', JSON.stringify(Array.from(new Set(favorites)))) |
| 337 |
} catch (err) { |
| 338 |
// eslint-disable-next-line no-console |
| 339 |
console.error('could not save favorite', err) |
| 340 |
} |
| 341 |
renderSelectList() |
| 342 |
return false |
| 343 |
} |
| 344 |
\end{lstlisting} |
| 345 |
|
| 346 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\jetbrainscode,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single,columns=flexible,showstringspaces=false] |
| 347 |
def Fibonacci(n) : |
| 348 |
# Check if input is 0 then it will print incorrect input |
| 349 |
if n < 0 : |
| 350 |
print("Incorrect input") |
| 351 |
elif n == 0 : |
| 352 |
return 0 |
| 353 |
elif 1 <= n <= 2 : |
| 354 |
return 1 |
| 355 |
else : |
| 356 |
return Fibonacci(n-1) + Fibonacci(n-2) |
| 357 |
\end{lstlisting} |
| 358 |
|
| 359 |
\pagebreak |
| 360 |
|
| 361 |
\section{History} |
| 362 |
|
| 363 |
\begin{verbatim} |
| 364 |
v0.1 Initial version |
| 365 |
\end{verbatim} |
| 366 |
|
| 367 |
\end{document} |