mp4096 / indentex

An indentation-based superset of LaTeX
MIT License
9 stars 2 forks source link

Bad indentation for end tags of fragile frames #6

Closed syxolk closed 7 years ago

syxolk commented 7 years ago

I got this indentex file main.inden.tex:

# documentclass: beamer

# usepackage: minted

# title: My Title
# date: My Date
# author: My Author
# institute: My Institute

# document:
  # frame [fragile]:
    # minted {xml}:
      <xml></xml>

Then try to make a PDF:

indentex main.inden.tex
pdflatex --shell-escape main_indentex.tex

But it fails with:

! File ended while scanning use of \next.

However, for some weird reason it doesn't fail if I manually remove the indentation of \end{frame}:

\documentclass{beamer}

\usepackage{minted}

\title{My Title}
\date{My Date}
\author{My Author}
\institute{My Institute}

\begin{document}
  \begin{frame}[fragile]
    \begin{minted}{xml}
      <xml></xml>
    \end{minted}
\end{frame}
\end{document}

I know this is mainly an issue of the beamer package but do you know of any quick workaround?

mp4096 commented 7 years ago

Quick workaround:

# documentclass: beamer

# usepackage: minted

# title: My Title
# date: My Date
# author: My Author
# institute: My Institute

\begin{document}
# frame [fragile]:
  # minted {xml}:
    <xml></xml>
\end{document}
mp4096 commented 7 years ago

Indeed I've seen a couple of weird LaTeX corners / packages where indentation matters (although it kind of shouldn't). TBH I personally do not encounter them often, so this is a totally untested territory. I'll take a look into it.

mp4096 commented 7 years ago

Maybe I should implement a transpilation flag that flattens all indents...

syxolk commented 7 years ago

Thanks for the workaround. Seems to compile now.

Regarding the beamer package: https://tex.stackexchange.com/questions/234778/indenting-endframe-in-fragile-slides

Someone mentions that is was fixed in December 2016: https://github.com/josephwright/beamer/commit/0c387deb21263aff6bc4864618e3cb74dcf32357

syxolk commented 7 years ago

Maybe I should implement a transpilation flag that flattens all indents...

Some ideas for naming:

mp4096 commented 7 years ago

Also possible: --flatten-output or --trim-indents.

I'm strongly against --disable-document-indent. First, I want to deal only with LaTeX syntax, not its semantics. Second, my root files contain only a bunch of \includes and \inputs, so it wouldn't help that much.

mp4096 commented 7 years ago

Closed in #10