I wrote an introduction note about python, which included something like the following
...
\usepackage{pythonhighlight}
...
the following indentation works in python
\begin{python}
a=5
if a==4:
print(a)
elif a==5:
print(a-1)
\end{python}
and removing the indentation leads to an error
\begin{python}
a=5
if a==4:
print(a)
elif a==5:
print(a-1)
\end{python}
When I compiled for the first time, the pdf had all the indentations that I wanted.
However, after I completed the note and distributed, I get questions about what I mean here. After check the latex file, I surprisingly found that all the indentation in the latex file get lost. So the above code becomes
...
\usepackage{pythonhighlight}
...
the following indentation works in python
\begin{python}
a=5
if a==4:
print(a)
elif a==5:
print(a-1)
\end{python}
and removing the indentation leads to an error
\begin{python}
a=5
if a==4:
print(a)
elif a==5:
print(a-1)
\end{python}
I, of course, didn't do anything. I am wondering what could be a potential reason for that. Could it be a hotkey combination that I accidentally touched? For your information, I use TeXstudio.
pythonhighlightbut I doubt that it messes with indentation of the source code not only because this would not be what a LaTeX package should do, but especially because it was exactly written for highlighting Python code where indentation is an important part of the syntax. Looking at the code of the package it only seems to define some styles for highlighting with thelistingspackage.pythonhighlight" is only an educated guess based on that only indentation in\begin{python}...\end{python}is lost.