5

DejaVu and Droid both provide good T2A typewriter fonts. I wanted to check if there are alternatives, but couldn't find a good way to do so using either http://www.tug.dk/FontCatalogue, CTAN, or MikTeX Console.

Example document:

\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1,T2A]{fontenc}

\usepackage{listings}
%\usepackage[ttdefault=true]{AnonymousPro}
\usepackage{sourcecodepro}

\lstset{
    language=Haskell,
    inputencoding=utf8,
    extendedchars=true,
    breaklines=true,
    escapeinside=!!,
    tabsize=4,
    breakatwhitespace=true,
    keepspaces=true
}
\lstset{
    literate={а}{{\selectfont\char224}}1
    {б}{{\selectfont\char225}}1
    {в}{{\selectfont\char226}}1
    {г}{{\selectfont\char227}}1
    {д}{{\selectfont\char228}}1
    {е}{{\selectfont\char229}}1
    {ё}{{\"e}}1
    {ж}{{\selectfont\char230}}1
    {з}{{\selectfont\char231}}1
    {и}{{\selectfont\char232}}1
    {й}{{\selectfont\char233}}1
    {к}{{\selectfont\char234}}1
    {л}{{\selectfont\char235}}1
    {м}{{\selectfont\char236}}1
    {н}{{\selectfont\char237}}1
    {о}{{\selectfont\char238}}1
    {п}{{\selectfont\char239}}1
    {р}{{\selectfont\char240}}1
    {с}{{\selectfont\char241}}1
    {т}{{\selectfont\char242}}1
    {у}{{\selectfont\char243}}1
    {ф}{{\selectfont\char244}}1
    {х}{{\selectfont\char245}}1
    {ц}{{\selectfont\char246}}1
    {ч}{{\selectfont\char247}}1
    {ш}{{\selectfont\char248}}1
    {щ}{{\selectfont\char249}}1
    {ъ}{{\selectfont\char250}}1
    {ы}{{\selectfont\char251}}1
    {ь}{{\selectfont\char252}}1
    {э}{{\selectfont\char253}}1
    {ю}{{\selectfont\char254}}1
    {я}{{\selectfont\char255}}1
    {А}{{\selectfont\char192}}1
    {Б}{{\selectfont\char193}}1
    {В}{{\selectfont\char194}}1
    {Г}{{\selectfont\char195}}1
    {Д}{{\selectfont\char196}}1
    {Е}{{\selectfont\char197}}1
    {Ё}{{\"E}}1
    {Ж}{{\selectfont\char198}}1
    {З}{{\selectfont\char199}}1
    {И}{{\selectfont\char200}}1
    {Й}{{\selectfont\char201}}1
    {К}{{\selectfont\char202}}1
    {Л}{{\selectfont\char203}}1
    {М}{{\selectfont\char204}}1
    {Н}{{\selectfont\char205}}1
    {О}{{\selectfont\char206}}1
    {П}{{\selectfont\char207}}1
    {Р}{{\selectfont\char208}}1
    {С}{{\selectfont\char209}}1
    {Т}{{\selectfont\char210}}1
    {У}{{\selectfont\char211}}1
    {Ф}{{\selectfont\char212}}1
    {Х}{{\selectfont\char213}}1
    {Ц}{{\selectfont\char214}}1
    {Ч}{{\selectfont\char215}}1
    {Ш}{{\selectfont\char216}}1
    {Щ}{{\selectfont\char217}}1
    {Ъ}{{\selectfont\char218}}1
    {Ы}{{\selectfont\char219}}1
    {Ь}{{\selectfont\char220}}1
    {Э}{{\selectfont\char221}}1
    {Ю}{{\selectfont\char222}}1
    {Я}{{\selectfont\char223}}1
}
\lstset{
    basicstyle=\ttfamily\footnotesize,
    commentstyle=\color{green}\itshape,
    keywordstyle= % TODO https://tex.stackexchange.com/questions/415777/avoid-highlighting-keywords-following-certain-words-in-listings
}

\begin{document}
    \lstinline|АБВ|
\end{document}
  • Look here maybe, which, however, lists all cyrillic fonts: tex.stackexchange.com/questions/114587/… – Jasper Habicht Feb 18 '18 at 9:09
  • It seems to be missing DejaVu, which is a big one (commented there). – Alexey Romanov Feb 18 '18 at 9:14
  • You should be aware of XeLaTeX or LuaLaTeX that actually supports using any font you want via the fontspec package. Here, some more fonts are shipped with the TeX distributions that, however, cannot easily be used with PDFLaTeX. – Jasper Habicht Feb 18 '18 at 11:05
  • Unfortunately, trying to compile my existing document with them gives a lot of errors. I'll need to figure out the necessary changes later. – Alexey Romanov Feb 18 '18 at 11:12
3

It depends with what you want to compile your document. For PDFLaTeX, the following is valid:

I just searched my TeX distribution (TeX Live 2017) for files with names starting with t2a or T2A and ending with .fd and got the following list:

t2aantt.fd
t2aanttc.fd
t2aanttl.fd
t2aanttlc.fd
t2accr.fd
t2acmbr.fd
t2acmdh.fd
t2acmfib.fd
t2acmfr.fd
t2acmr.fd
t2acmss.fd
t2acmtl.fd
t2acmtt.fd
t2acmvtt.fd
t2afca.fd
t2afcm.fd
t2afco.fd
t2afcs.fd
t2afct.fd
t2afdm.fd
t2afdr.fd
t2afds.fd
T2Afla.fd
t2afmm.fd
t2afos.fd
t2afosj.fd
t2agentium.fd
t2aiwona.fd
t2aiwonac.fd
t2aiwonal.fd
t2aiwonalc.fd
t2akurier.fd
t2akurierc.fd
t2akurierl.fd
t2akurierlc.fd
t2alcmss.fd
t2alcmtt.fd
t2atempora-tlf.fd
t2atempora-tosf.fd
T2ACochineal-LF.fd
T2ACochineal-OsF.fd
T2ACochineal-Sup.fd
T2ACochineal-TLF.fd
T2ACochineal-TOsF.fd
T2ADejaVuSans-TLF.fd
T2ADejaVuSansCondensed-TLF.fd
T2ADejaVuSansMono-TLF.fd
T2ADejaVuSerif-TLF.fd
T2ADejaVuSerifCondensed-TLF.fd
T2Aerewhon-Dnom.fd
T2Aerewhon-Inf.fd
T2Aerewhon-LF.fd
T2Aerewhon-Numr.fd
T2Aerewhon-OsF.fd
T2Aerewhon-Sup.fd
T2Aerewhon-TLF.fd
T2Aerewhon-TOsF.fd
T2AHeuristica-Inf.fd
T2AHeuristica-Sup.fd
T2AHeuristica-TLF.fd
T2AHeuristica-TOsF.fd
T2ALinuxLibertineT-LF.fd
T2ALinuxLibertineT-OsF.fd
T2ALinuxLibertineT-TLF.fd
T2ALinuxLibertineT-TOsF.fd
T2ANimbusMono.fd
T2ANimbusMonoN.fd
T2ANimbusSans.fd
T2ANimbusSerif.fd
T2APTMono-TLF.fd
T2APTSans-TLF.fd
T2APTSansCaption-TLF.fd
T2APTSansNarrow-TLF.fd
T2APTSerif-TLF.fd
T2APTSerifCaption-TLF.fd
T2Alato-LF.fd
T2Alato-OsF.fd
T2Alato-TLF.fd
T2Alato-TOsF.fd
T2AXCharter-Sup.fd
T2AXCharter-TLF.fd
T2AXCharter-TOsF.fd

Of these, the following are monospaced fonts:

t2acmtl.fd
t2acmtt.fd
t2afct.fd
t2afdm.fd
t2alcmtt.fd
T2ADejaVuSansMono-TLF.fd
T2ANimbusMono.fd
T2ANimbusMonoN.fd
T2APTMono-TLF.fd

But then, there are of course other fonts that can be used with fontspec and XeLaTeX or LuaLaTeX. For these, you could check in the font information for the scripts supported by these fonts.

  • 1
    Searching for file names containing t2a is probably better. At least on MikTeX (so I assume on TeX Live too) this doesn't cover Droid (EDIT: actually it doesn't have an .fd file at all, but .tfm and .vf files). – Alexey Romanov Feb 18 '18 at 11:08
  • Actually, I don’t even know if it is obligatory to put the encoding in the font file name. So, there may be even more fonts, but I don’t know how to efficiently search for these. – Jasper Habicht Feb 18 '18 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.