Correct font for subroutines in Latex

Today I learned that Latex supports many different typefaces: https://www.overleaf.com/learn/latex/font_typefaces and http://www.personal.ceu.hu/tex/typeface.htm

I’ve seen papers like this one (https://arxiv.org/pdf/2006.15704.pdf) uses a different font for subroutines (like function names or APIs). One example is from their reference to the “CrossEntropyLoss” function:

Now, I try by myself different typefaces and see which one it uses:

{\rm CrossEntropyLoss rm}

{\sl CrossEntropyLoss sl} 

{\sf CrossEntropyLoss sf} 

{\sf CrossEntropyLoss sf} 

{\tt CrossEntropyLoss tt}  

{\sc CrossEntropyLoss sc}

{\fontfamily{qcr}\selectfont
CrossEntropyLoss qcr
}

{\fontfamily{bch}\selectfont
CrossEntropyLoss bch
}

{\fontfamily{lmtt}\selectfont
CrossEntropyLoss lmtt
}

I think the closest font is lmtt

Leave a comment

Your email address will not be published. Required fields are marked *