4

I have got some special characters I wish Latex to treat 'as is', which I understood Verbatim is for (I'm new to Latex).

\begin{verbatim}
        ┌─┐
q_0: |0>┤M├
        └╥┘
 c_0: 0 ═╩═
\end{verbatim}

However the PDF result shows up as ???

        ???
q_0: |0>?M?
        ???
 c_0: 0 ???

How can I show/print my special characters properly?

10

One possibility is with the pmboxdraw package:

\documentclass[]{article}
\usepackage{pmboxdraw}
\begin{document}

\begin{verbatim}
        ┌─┐
q_0: |0>┤M├
        └╥┘
 c_0: 0 ═╩═
\end{verbatim}

\end{document}

enter image description here

Another with lualatex and a suitable typewriter font:

\documentclass[]{article}
\usepackage{fontspec}
\setmonofont{DejaVuSansMono}
\begin{document}

\begin{verbatim}
        ┌─┐
q_0: |0>┤M├
        └╥┘
 c_0: 0 ═╩═
\end{verbatim}

\end{document}

enter image description here

  • The first solution works great, though only when i put it in a new empty latex document. not my current one, trying to figure out why its not doing anything (compiles just fine) – Krijn van der Burg Nov 19 at 22:39
  • Can't seem to get it working in my current document, would you have a clue why? – Krijn van der Burg Nov 19 at 22:56
  • 3
    minimize your document until you find the conflicting package. – Ulrike Fischer Nov 19 at 23:03
  • Even when i remove everything in the document, and copy exactly your answer.. it still doesnt work. Even though it does when I make a new document. I tried restarting Texteditor. – Krijn van der Burg Nov 19 at 23:25
  • 4
    Are you sure that your document is utf8 encoded? – Ulrike Fischer Nov 19 at 23:32

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.