1

I want to include a code segment, which is written in Go. I did use the minted package for it. But, when I copy paste the code from my editor to Texmaker, the tabs are actually displayed as ^^I. Here is a small screenshot for it: http://prntscr.com/gb78ou

I don't have anything fancy there, just this:

\documentclass[a4paper]{paper}

\usepackage{minted}
\usemintedstyle{colorful}

\begin{document}

\begin{minted}{go}
func ntt(a *[N]uint16, omega *[N/2]uint16) {
    for level := uint(0); level < 8; level++ {
        for start := uint(0); start < (1 << level); start++ {
            jTwiddle := 0
            for j := start; j < N-1; j += 2 * (1 << level) {
                W := omega[jTwiddle]
                jTwiddle++
                temp := a[j]
\end{minted}

\end{document}

Any idea how to make the ^^I disappear from the code segment?

  • 1
    I can't reproduce this. Is your minted up-to-date? – Ulrike Fischer Aug 21 '17 at 15:52
  • What engine are you using? pdflatex, xelatex or lualatex? – egreg Aug 21 '17 at 19:25
1

I can reproduce the issue when compiling the file with XeLaTeX. You should use the -8bit option:

xelatex -8bit -shell-escape filename

You should also add \setminted{tabsize=4} (the default value is 8).

\documentclass[a4paper]{paper}

\usepackage{minted}
\usemintedstyle{colorful}

\setminted{tabsize=4}

\begin{document}

\begin{minted}{go}
func ntt(a *[N]uint16, omega *[N/2]uint16) {
    for level := uint(0); level < 8; level++ {
        for start := uint(0); start < (1 << level); start++ {
            jTwiddle := 0
            for j := start; j < N-1; j += 2 * (1 << level) {
                W := omega[jTwiddle]
                jTwiddle++
                temp := a[j]
\end{minted}

\end{document}

With the -8bit command line option I get

enter image description here

Without the option

enter image description here

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.