1

I would like to use the OCR-B font provided by the ocr package as the default mono font in my document. Because of other font choices, I would also like to use the T1 fontenc.

The below MWE compiles with this warning and the "TT Test" text comes out in Computer Modern:

LaTeX Font Warning: Font shape `T1/ocrb/m/n' undefined
(Font)              using `T1/cmr/m/n' instead on input line 9.
\documentclass[convert, varwidth]{standalone}
\usepackage{ocr}
\usepackage[T1]{fontenc}

\renewcommand*{\ttdefault}{ocrb}

\begin{document}
Roman Test
\texttt{TT Test}
\end{document}

MWE output showing both lines in Roman instead of the second line in OCR-B

This works properly without the T1 fontenc.

Is it possible to mix font encodings in this way?

4

You can locally switch to OT1 encoding. Be aware that this means that Umlauts and other chars with accents are built with accents and so don't copy&paste correctly.

\documentclass{article}
\usepackage{ocr}
\usepackage[T1]{fontenc}

\let\ttfamily\ocrfamily
\begin{document}
Roman 
\texttt{TT Test äöüßé}
\end{document}

enter image description here

|improve this answer|||||

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.