I'm preparing tutorial for students with code fragments that they will copy to a text editor.

Is there a way to make syntax-highlighted code copyable to text editor so that indentation is preserved, when indenting with tabs?

I was able to achieve this with space-indented code, using this answer: https://tex.stackexchange.com/a/148661/16951

So I tried to do the same with tabs, so change the visible tab character to normal tab, but I don't know what is the visible tab character code. It seems it's not a single character, because when I copy it, I get i | in text editor.

Is there a way to add copyable invisible tabs to minted-coloured code?

Here is my minimal example (the HTML code is indented with tabs, but I think it's not preserved when SE question is rendered):

\documentclass[10pt, a4paper, oneside]{article}
\usepackage{polski, indentfirst}


\NewDocumentEnvironment {codehtml} {}
\begin{minted}[tabsize=4, obeytabs, showtabs]{html}}


<!DOCTYPE html>
<html lang="pl">
        <meta charset="utf-8">



Your Answer

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

Browse other questions tagged or ask your own question.