[TxMt] Re: sudden latex tidy and latex compiling errors

René Schwaiger sanssecours at f-m.fm
Wed Feb 11 23:49:19 UTC 2015


Hi Anthony,

> On 11 Feb 2015, at 23:51 , Anthony V. Pulido <anthony.pulido at gmail.com> wrote:
> 
> I've followed the instructions in the error message and installed File::HomeDir. Latexindent now works, but despite the image of comprehensiveness the documentation seems to provide, it seems to lack some features of the previous version of latex tidy. Is there anyway to get the previous version back?

yes. I will try to incorporate both commands and use `LaTeXTidy` as default tomorrow in the morning (GMT+1). It is quite late here and I fear that if I change something now, that I would only make things worse. 

> Although latexindent nicely formats align environments and matrices, some of the automation available in the previous version of latex tidy seems to have been lost.
> 
> For example, consider the following:
> 
> \begin{lem}
> 	\label{1.19:lem1}
> 	\[ \left\{ 
> 	\begin{matrix}
> 		p \in \al\\
> 		q \notin \al 
> 	\end{matrix}
> 	\right\}\implies p < q.\]
> \end{lem}
> 
> which was indented by latex tidy. Latexindent now indents this as:
> 
> \begin{lem}\label{1.19:lem1} 
> 	\[ \left\{ 		
> 		\begin{matrix}
> 			p \in \al    \\
> 			q \notin \al 
> 		\end{matrix}
> 		\right\} 
> 		\implies p < q.\]
> 		\end{lem}
> 
> If I move the last \] to the next line, latexindent indents this as
> 
> \begin{lem}\label{1.19:lem1} 
> 	\[ \left\{ 		
> 		\begin{matrix}
> 			p \in \al    \\
> 			q \notin \al 
> 		\end{matrix}
> 		\right\} 
> 		\implies p < q.
> 	\]
> \end{lem}
> 
> which looks better, but means that I now have to format my files according to latexindent's rules for it to work correctly. Somehow, this seems to defeat the purpose of an automatic text formatter. The pattern in the example is repeated often in documents of mine thousands of lines long and so, when this behavior of latexindent cascades, it causes lines that should not be indented, to be indented. For example, the following was formatted by latexindent:
> 
> \begin{lem}\label{xyz} 
> 	\[ \left\{ 		
> 		\begin{matrix}
> 			p \in \al    \\
> 			q \notin \al 
> 		\end{matrix}
> 		\right\} 
> 		\implies p < q.\]
> 		\end{lem}
> 		
> 		This text should be at the beginning of the line.
> 		
> 		\begin{lem}\label{xyz} 
> 			\[ \left\{ 		
> 				\begin{matrix}
> 					p \in \al    \\
> 					q \notin \al 
> 				\end{matrix}
> 				\right\} 
> 				\implies p < q.\]
> 				\end{lem}
> 
> Latex tidy would have had no problem with this. The documents of mine tend to consist of environments nested several levels deep, (which is why latex tidy is important to me) and now the test copy on which I tried latexindent has text indented off the screen. Other examples of unexpected behavior, which might not be a complete list... :
> 
> after \documentclass{...} latexindent does not adjust indentation, and so
> 
> \documentclass{article}
> 
> \usepackage{...}
> 
>      \usepackage{...}
> 
>             \usepackage{...}
> 
> is left untouched. Latex tidy would have brought them to the beginning of the line.
> 
> Latexindent does not seem to put text inside \[ \] on a separate line, whereas latex tidy did, and so,
> 
> asdadfa \[ sdfada \] asdfasdfa
> 
> would have been changed to
> 
> asdadfa
> \[ sdfada \]
> asdfasdfa
> 
> Latexindent leaves it unchanged.
> 
> It is the same with environments:
> 
> \begin{abc} jkl \end{abc}
> 
> would have been changed to
> 
> \begin{abc}
>    this text would be indented.
> \end{abc}
> 
> but latexindent leaves it untouched. 

Thank you for the thorough analysis of the tool. I think the authors of `latexindent` might be interested about your thoughts too. You can report bugs, or request features at the official [GitHub page](https://github.com/cmhughes/latexindent.pl/issues). Your comments could provide the feedback that they need to improve `latexindent` not only for you, but also other users who use `latexindent` now or plan to use it sometimes in the future.

> It also doesn't compress multiple blank lines. In summary, latex tidy could take almost any mess I typed and put it in the right place.

I have to admit that I did not use “Tidy” for my own documents. For me tex documents pretty much just looked the same way after I invoked “Tidy”. This was also the reason why I replaced `LaTeXTidy` with `latexindent`. `latexindent` just produced nicer looking output when I invoked it on a sample document.

> Would it be possible for the old latex tidy to be re-added to the bundle alongside latexindent?

That is my current plan.

> Or would it be possible to configure latexindent to mimic certain features of latextidy?

I guess it could be possible to mimic some of the features. I did not study the documentation of `latexindent` tough. As I already mentioned, feedback/feature requests on the official GitHub page might help to improve `latexindent`.

> Anthony

Kind regards,
  René


More information about the textmate mailing list