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

Anthony V. Pulido anthony.pulido at gmail.com
Wed Feb 11 22:51:59 UTC 2015


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?

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.

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.

Would it be possible for the old latex tidy to be re-added to the bundle
alongside latexindent? Or would it be possible to configure latexindent to
mimic certain features of latextidy?

Anthony



On Wed, Feb 11, 2015 at 1:45 PM, Anthony V. Pulido <anthony.pulido at gmail.com
> wrote:

> Hello René and Allan,
>
> Thank you very much for your messages. I am using MacTeX 2014, and just
> before I performed the procedure you outlined, I updated using texlive
> (which usually works for me!). Your procedure worked without returning the
> pmatrix error, but now when I invoke tidy I receive this message:
>
> Can't locate File/HomeDir.pm in @INC (you may need to install the
> File::HomeDir module) (@INC contains:
> /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18
> /Network/Library/Perl/5.18/darwin-thread-multi-2level
> /Network/Library/Perl/5.18
> /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level
> /Library/Perl/Updates/5.18.2
> /System/Library/Perl/5.18/darwin-thread-multi-2level
> /System/Library/Perl/5.18
> /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level
> /System/Library/Perl/Extras/5.18 .) at /usr/texbin/latexindent line 40.
> BEGIN failed--compilation aborted at /usr/texbin/latexindent line 40.
>
> Concerning the mtpro2 fonts, I tried it, and I found that for some reason,
> it will not give that error when used independently, but not together with
> the times font package. And so, in the preamble:
>
> \pdfmapfile{=mtpro2.map}
> \usepackage[mtphrb,subscriptcorrection]{mtpro2}  % [lite] works, too.
> (I've bought the fonts.)
>
> works but
>
> \usepackage{times}
>
> \pdfmapfile{=mtpro2.map}
> \usepackage[mtphrb,subscriptcorrection]{mtpro2}
>
> will not work.
>
> Just in case, this also does not work:
>
>
> \pdfmapfile{=mtpro2.map}
> \usepackage[mtphrb,subscriptcorrection]{mtpro2}
>
> \usepackage{times}
>
> Finally, using just
>
> \usepackage{times}
>
> works.
>
> I just tried something else and I am now wondering if this a problem with
> one of my files. I don't think I changed it in a strange way yesterday, but
> it's possible I did...
>
> I commented one of the \include{}'s and it worked. When it is not
> commented, I receive the following error in the console at the end (In
> addition to "Command returned status code 1.").
>
> Traceback (most recent call last): File
> "/Users/Anthony/Library/Application
> Support/TextMate/Managed/Bundles/LaTeX.tmbundle/Support/bin/texmate.py",
> line 1061, in status = run_latex(command, filename, cache_filename,
> verbose) File "/Users/Anthony/Library/Application
> Support/TextMate/Managed/Bundles/LaTeX.tmbundle/Support/bin/texmate.py",
> line 224, in run_latex fatal, errors, warnings = lp.parse_stream() File
> "/Users/Anthony/Library/Application
> Support/TextMate/Managed/Bundles/LaTeX.tmbundle/Support/lib/parsing.py",
> line 603, in parse_stream return super(LaTexParser, self).parse_stream()
> File "/Users/Anthony/Library/Application
> Support/TextMate/Managed/Bundles/LaTeX.tmbundle/Support/lib/parsing.py",
> line 187, in parse_stream line = self.get_rewrapped_line() File
> "/Users/Anthony/Library/Application
> Support/TextMate/Managed/Bundles/LaTeX.tmbundle/Support/lib/parsing.py",
> line 135, in get_rewrapped_line statement += line.rstrip('\n')
> UnicodeDecodeError: 'utf8' codec can't decode byte 0xa4 in position 1:
> invalid start byte
>
> I don't think it is a problem with the latex syntax, since the file seems
> to work in the modes described above. Any ideas?
>
> Anthony
>
>
>
> On Wed, Feb 11, 2015 at 9:35 AM, René Schwaiger <sanssecours at f-m.fm>
> wrote:
>
>> Hi Allan,
>>
>> > On 11 Feb 2015, at 14:41 , Allan Odgaard <mailinglist at textmate.org>
>> wrote:
>> >
>> > On 11 Feb 2015, at 20:01, René Schwaiger wrote:
>> >
>> >> I would like to remove the library code from the bundle sometimes in
>> the future tough. Is there a nice way to install external dependencies via
>> TextMate? […]
>> >
>> > There is not, and I also question the wisdom of doing that.
>> >
>> > If you install something on the user’s system, there is a good chance
>> that a) they will never update it and b) they will not know how to
>> uninstall it (should they later not want the thing that installed it). And
>> installing things globally can cause conflicts.
>>
>> I guess you are right. I will keep the current system for now.
>>
>> > So I definitely recommend having the non-standard dependencies isolated
>> in the bundle. Of course if there is a chance that the user is a CPAN user
>> who is on top of updating their libraries, one could prefer to look for the
>> library in the standard system path, before using the bundled version.
>>
>> Unfortunately $PERL5LIB is prepended to the library path. A quick search
>> did not show an easy way to append a directory to the Perl search path in a
>> shell script. So I will leave it as it is for now, unless somebody provides
>> a good reason why we should prefer the systems `YAML::Tiny` version over
>> the one shipped with the bundle.
>>
>> Kind regards,
>>   René
>>
>> _______________________________________________
>> textmate mailing list
>> textmate at lists.macromates.com
>> http://lists.macromates.com/listinfo/textmate
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20150211/19de3f2c/attachment-0001.html>


More information about the textmate mailing list