0

The following examples are visually identical code. The only difference is that the indents were done differently. Four spaces were used in the first and a tab was used in the second.

1.

\documentclass{article}
\usepackage{sagetex}
\begin{document}

\begin{sageblock} def f(x): return x \end{sageblock}

f(x) returns itself. For example, $f(2)=\sage{f(2)}$.

\end{document}

Output:

 def f(x):
    return x
f(x) returns itself. For example, f(2) = 2.
\documentclass{article}
\usepackage{sagetex}
\begin{document}

\begin{sageblock} def f(x): return x \end{sageblock}

f(x) returns itself. For example, $f(2)=\sage{f(2)}$.

\end{document}

Output:

 def f(x):
 return x
f(x) returns itself. For example, f(2) = ??.

Errors:

  File "./example.sagetex.sage.py", line 14
    return x
    ^
IndentationError: expected an indented block

LaTeX Warning: Reference @sageinline0 on page 1 undefined on input line 11.

It is clear that sagetex ignores indents done in tabs by observing the error and how the code is printed verbatim. What can be done so that tabs are also recognized as indents?

  • The package writers did not think of that I guess. You need to patch the relevant "functions" then. – user202729 Oct 31 '22 at 17:32
  • Try adding \edef\dospecials{\unexpanded\expandafter{\dospecials}\noexpand\do\noexpand\^^I} to the start of the document. https://tex.stackexchange.com/questions/508001/keyboard-tab-character-in-argument-v-xparse/508103#comment1284730_508001 – user202729 Oct 31 '22 at 17:33

0 Answers0