Hello,
I was using Textmate 2.0 beta 6.8, and suddenly, I received this error when I invoked latex tidy:
Can't locate YAML/Tiny.pm in @INC (you may need to install the YAML::Tiny 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 /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 20. BEGIN failed--compilation aborted at /usr/texbin/latexindent line 20.
I use tidy often, and it usually works. I am sure I used it earlier today without incident.
Further, I also suddenly received the error "Command returned status code 1." for Typeset and view (PDF) when I compiled a latex file. The file uses the mtpro2 fonts, which, when disabled, allowed the file to compile again, but this is the first time this has happened. I did compile the file with the fonts enabled earlier today.
Thank you for any help.
Best wishes,
Anthony Pulido
Hi Anthony,
On 11 Feb 2015, at 24:40 , Anthony V. Pulido anthony.pulido@gmail.com wrote:
Hello,
I was using Textmate 2.0 beta 6.8, and suddenly, I received this error when I invoked latex tidy:
Can't locate YAML/Tiny.pm in @INC (you may need to install the YAML::Tiny 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 /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 20. BEGIN failed--compilation aborted at /usr/texbin/latexindent line 20.
I use tidy often, and it usually works. I am sure I used it earlier today without incident.
I recently removed the old `LaTeXTidy` script from the LaTeX Bundle [1]. The “Tidy” command now uses `latexindent` [2]. `latexindent` is installed by default, but the YAML library it needs is not. You need to install PYAML for the command to work. To install the dependency:
1. Open Terminal 2. Install the `cpanm` package manager
sudo cpan App::cpanminus
3. Install `YAML::Tiny` with cpanm
sudo cpanm YAML::Tiny
If you did not update MacTeX recently, then you now get the error message:
YAML::Tiny found a duplicate key 'pmatrix'…
This is the result of a duplicate key in `/usr/local/texlive/2014/texmf-dist/scripts/latexindent/defaultSettings.yaml`.
Open the file with TextMate, for example by issuing the following command inside Terminal:
mate /usr/local/texlive/2014/texmf-dist/scripts/latexindent/defaultSettings.yaml
Now search for `pmatrix` and remove one of the two occurrences. You can also update your TeX Distribution to fix the bug, for example by using “TeX Live Utility” [3]. I would recommend against that however, since I broke my TeX distribution that way once. For more information on the `latexindent` bug you can take a look at a bug report at StackExchange [4].
[1]: https://github.com/textmate/latex.tmbundle/commit/8012f20f979d1eee65724650bb... [2]: http://www.ctan.org/pkg/latexindent [3]: https://github.com/amaxwell/tlutility [4]: http://tex.stackexchange.com/questions/220719/workaround-for-latexindent-bug
Sorry that I broke your workflow. I will try to come up with a solution that auto-installs the dependency.
Further, I also suddenly received the error "Command returned status code 1." for Typeset and view (PDF) when I compiled a latex file. The file uses the mtpro2 fonts, which, when disabled, allowed the file to compile again, but this is the first time this has happened. I did compile the file with the fonts enabled earlier today.
A tex file with the following content:
\documentclass{article} \usepackage[lite]{mtpro2} \begin{document} $1 + 1 = 2$ \end{document}
works for me. Could you please provide a (minimal) example, so that I can try to debug the problem?
Thank you for any help.
Sorry again for breaking the bundle commands. If you have further questions please just ask. I am always happy about feedback.
Best wishes,
Anthony Pulido
Kind regards, René
Hi Allan,
On 11 Feb 2015, at 10:56 , Allan Odgaard mailinglist@textmate.org wrote:
On 11 Feb 2015, at 15:38, René Schwaiger wrote:
Can't locate YAML/Tiny.pm in @INC […]
[…] You need to install PYAML for the command to work.
Is it possible to place the YAML library in the bundle’s support folder and add that to perl’s include path?
I just did that in the latest commit [GitHub]. Thanks for the helpful suggestion.
[GitHub]: https://github.com/textmate/latex.tmbundle/commit/35233d4eb14d46fa553cc04495...
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? The code I came up with:
```bash { # Try to run `latexindent` latexindent -c=/tmp "${TM_FILENAME}" } || { # `latexindent` failed. Most likely this was caused by `Tiny::YAML` not # being installed osascript -e "do shell script "cpan App::cpanminus && cpanm YAML::Tiny"\ with administrator privileges" > /dev/null || { exit_show_tool_tip "Could not install YAML::Tiny" } latexindent -c=/tmp "${TM_FILENAME}" } ```
has the problem, that there is no feedback for the installation process. Comments would be appreciated.
Kind regards,
René
On 11 Feb 2015, at 20:01, René Schwaiger wrote:
Is it possible to place the YAML library in the bundle’s support folder and add that to perl’s include path?
I just did that in the latest commit [GitHub]. Thanks for the helpful suggestion.
Thanks for making the change! :)
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.
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.
Hi Allan,
On 11 Feb 2015, at 14:41 , Allan Odgaard mailinglist@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é
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@f-m.fm wrote:
Hi Allan,
On 11 Feb 2015, at 14:41 , Allan Odgaard mailinglist@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@lists.macromates.com http://lists.macromates.com/listinfo/textmate
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@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@f-m.fm wrote:
Hi Allan,
On 11 Feb 2015, at 14:41 , Allan Odgaard mailinglist@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@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Hi Anthony,
On 11 Feb 2015, at 23:51 , Anthony V. Pulido anthony.pulido@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é
Hi René, I'm so relieved that latex tidy is coming back. No worry! Please take the time you need.
I'll see if I can produce a sample document to reproduce the other error, and I'll see about submitting comments to the github page on latexindent.
Thanks again!
Best wishes,
Anthony
On Wed, Feb 11, 2015 at 6:49 PM, René Schwaiger sanssecours@f-m.fm wrote:
Hi Anthony,
On 11 Feb 2015, at 23:51 , Anthony V. Pulido anthony.pulido@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é
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
I’ve used `LaTeXTidy` regularly for some months now, and for me it is all good…with just one niggle:
A common idiom is \begin{environment} \label{env:whatever} ... \end{environment}
except in captioned environments (table etc) when you usually want \begin{environment} ... \label{env:whatever} \end{environment}
This idiom is reflected perfectly in the LaTeX bundle’s ctrl-< functionality, which I love so much I should probably get therapy.
`LaTeXTidy` has the unfortunate feature of moving the \label to its own line, so the result in any case is \begin{environment} ... \label{env:whatever} ... \end{environment}
My issue is that this cripples code folding. Before I run `LaTeXTidy` I can fold my LaTeX so I only see the environments and their \labels, which is exactly what I want. After `LaTeXTidy`, code folding hides the \labels, so all I see is \begin{environment}\end{environment}, which is probably not what anyone wants. I have Find&Replace workarounds, to put the \labels back on the lines I want them on, but it would be really neat if `LaTeXTidy` effectively left them there.
The LaTeX bundle is a terrific piece of work in general, and although I use it every day this is the only minor grumble I can think of. And there is nothing else I would seriously suggest changing about `LaTeXTidy`.
Robert
On 11 Feb 2015, at 23:49, René Schwaiger sanssecours@f-m.fm wrote:
Hi Anthony,
On 11 Feb 2015, at 23:51 , Anthony V. Pulido <anthony.pulido@gmail.com mailto:anthony.pulido@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 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é
textmate mailing list textmate@lists.macromates.com mailto:textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate http://lists.macromates.com/listinfo/textmate
Hi,
commit [9c95d16c] re-adds “LaTeX Tidy” as default tex formatter. Hopefully this should close the issues reported here concerning `latexindent`.
[9c95d16c]: https://github.com/textmate/latex.tmbundle/commit/9c95d16cd74c736919d85eea9f...
As for the problems translating files: Jan-Gerd Tenberge provided a minimal sample file [here](https://github.com/textmate/latex.tmbundle/issues/117). Hopefully commit [9dc4164] fixes the problem. It would be super helpful if some of you could test the new code and report your findings.
[9dc4164]: https://github.com/textmate/latex.tmbundle/commit/9dc4164e59f9f31ebfc2978f0e...
Kind regards, René
Hello René, I'm sorry to ask this, but how does one update the bundle? Does one just wait for TM to do it, or is there a way to do it manually?
Thank you and best wishes,
Anthony
On Thu, Feb 12, 2015 at 6:57 AM, René Schwaiger sanssecours@f-m.fm wrote:
Hi,
commit [9c95d16c] re-adds “LaTeX Tidy” as default tex formatter. Hopefully this should close the issues reported here concerning `latexindent`.
As for the problems translating files: Jan-Gerd Tenberge provided a minimal sample file [here]( https://github.com/textmate/latex.tmbundle/issues/117). Hopefully commit [9dc4164] fixes the problem. It would be super helpful if some of you could test the new code and report your findings.
Kind regards, René
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Hi Anthony,
On 12 Feb 2015, at 16:42 , Anthony V. Pulido anthony.pulido@gmail.com wrote:
Hello René, I'm sorry to ask this, but how does one update the bundle?
all bundles installed inside Preferences are auto-updated. This means that after Allan or Michael push out changes, the bundle should get updated automatically after a few hours.
Does one just wait for TM to do it, or is there a way to do it manually?
Yes, there is a way to update a bundle manually:
1. Uninstall the bundle inside “Preferences” 2. Open Terminal 3. Clone the bundle into the folder `~/Library/Application\ Support/TextMate/Managed/Bundles/` e.g. for the LaTeX bundle:
cd ~/Library/Application\ Support/TextMate/Managed/Bundles/ git clone https://github.com/textmate/latex.tmbundle.git
Thank you and best wishes,
Anthony
Kind regards, René
Ok, thank you, René!
Best wishes,
Anthony
On Thu, Feb 12, 2015 at 11:04 AM, René Schwaiger sanssecours@f-m.fm wrote:
Hi Anthony,
On 12 Feb 2015, at 16:42 , Anthony V. Pulido anthony.pulido@gmail.com
wrote:
Hello René, I'm sorry to ask this, but how does one update the bundle?
all bundles installed inside Preferences are auto-updated. This means that after Allan or Michael push out changes, the bundle should get updated automatically after a few hours.
Does one just wait for TM to do it, or is there a way to do it manually?
Yes, there is a way to update a bundle manually:
- Uninstall the bundle inside “Preferences”
- Open Terminal
- Clone the bundle into the folder `~/Library/Application\
Support/TextMate/Managed/Bundles/` e.g. for the LaTeX bundle:
cd ~/Library/Application\ Support/TextMate/Managed/Bundles/ git clone https://github.com/textmate/latex.tmbundle.git
Thank you and best wishes,
Anthony
Kind regards, René
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Hi Robert,
On 12 Feb 2015, at 1:28 , Robert Milton robert.gomez.milton@gmail.com wrote:
I’ve used `LaTeXTidy` regularly for some months now, and for me it is all good…with just one niggle:
A common idiom is \begin{environment} \label{env:whatever} ... \end{environment}
except in captioned environments (table etc) when you usually want \begin{environment} ... \label{env:whatever} \end{environment}
This idiom is reflected perfectly in the LaTeX bundle’s ctrl-< functionality, which I love so much I should probably get therapy.
`LaTeXTidy` has the unfortunate feature of moving the \label to its own line, so the result in any case is \begin{environment} ... \label{env:whatever} ... \end{environment}
My issue is that this cripples code folding. Before I run `LaTeXTidy` I can fold my LaTeX so I only see the environments and their \labels, which is exactly what I want. After `LaTeXTidy`, code folding hides the \labels, so all I see is \begin{environment}\end{environment}, which is probably not what anyone wants. I have Find&Replace workarounds, to put the \labels back on the lines I want them on, but it would be really neat if `LaTeXTidy` effectively left them there.
there is the option that we could change “LaTeX Tidy” so that it ignores lines containing labels. But it would take some time for me to do that. I poked around the script a little bit. Basically the script just uses a lot of regular expression substitutions to change the tex file. After I did not get something working after two hours, I just resorted to the same thing you mentioned. So I just used substitution to “fix” the changes by “LaTeX Tidy” that you do not like. For example:
The second example you mentioned was
\begin{environment} ... \label{env:whatever} \end{environment}
After we use “LaTeX Tidy” we get
\begin{environment} \label{env:whatever} \end{environment}
We can fix that by using the regular expression
^\s*(\label{[^}]*})\s*(\end{[^}]+})
and the substitution `$1$2`. The same works in Perl too of course. So you could edit `latextidy.pl` and insert the following before the statement `print $string;` at the end of the file:
$string =~ s/^\s*(\label{[^}]*})\s*(\end{[^}]+})/$1$2/mg;
This way you should get the output you want. You can use the same pattern to fix the other things you do not like.
The LaTeX bundle is a terrific piece of work in general, and although I use it every day this is the only minor grumble I can think of. And there is nothing else I would seriously suggest changing about `LaTeXTidy`.
Robert
Kind regards, René
Thanks René, particularly for making me aware of latextidy.pl. I had a quick look and I reckon I’ll try hacking it as you suggest. Keep up the good work, and please bear this issue in mind should you ever have time on your hands, or a similar request from other users.
Regards Robert
On 12 Feb 2015, at 15:52, René Schwaiger sanssecours@f-m.fm wrote:
Hi Robert,
On 12 Feb 2015, at 1:28 , Robert Milton robert.gomez.milton@gmail.com wrote:
I’ve used `LaTeXTidy` regularly for some months now, and for me it is all good…with just one niggle:
A common idiom is \begin{environment} \label{env:whatever} ... \end{environment}
except in captioned environments (table etc) when you usually want \begin{environment} ... \label{env:whatever} \end{environment}
This idiom is reflected perfectly in the LaTeX bundle’s ctrl-< functionality, which I love so much I should probably get therapy.
`LaTeXTidy` has the unfortunate feature of moving the \label to its own line, so the result in any case is \begin{environment} ... \label{env:whatever} ... \end{environment}
My issue is that this cripples code folding. Before I run `LaTeXTidy` I can fold my LaTeX so I only see the environments and their \labels, which is exactly what I want. After `LaTeXTidy`, code folding hides the \labels, so all I see is \begin{environment}\end{environment}, which is probably not what anyone wants. I have Find&Replace workarounds, to put the \labels back on the lines I want them on, but it would be really neat if `LaTeXTidy` effectively left them there.
there is the option that we could change “LaTeX Tidy” so that it ignores lines containing labels. But it would take some time for me to do that. I poked around the script a little bit. Basically the script just uses a lot of regular expression substitutions to change the tex file. After I did not get something working after two hours, I just resorted to the same thing you mentioned. So I just used substitution to “fix” the changes by “LaTeX Tidy” that you do not like. For example:
The second example you mentioned was
\begin{environment} ... \label{env:whatever} \end{environment}
After we use “LaTeX Tidy” we get
\begin{environment} \label{env:whatever} \end{environment}
We can fix that by using the regular expression
^\s*(\label{[^}]*})\s*(\end{[^}]+})
and the substitution `$1$2`. The same works in Perl too of course. So you could edit `latextidy.pl` and insert the following before the statement `print $string;` at the end of the file:
$string =~ s/^\s*(\label{[^}]*})\s*(\end{[^}]+})/$1$2/mg;
This way you should get the output you want. You can use the same pattern to fix the other things you do not like.
The LaTeX bundle is a terrific piece of work in general, and although I use it every day this is the only minor grumble I can think of. And there is nothing else I would seriously suggest changing about `LaTeXTidy`.
Robert
Kind regards, René
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Hi Anthony,
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
It looks like an encoding problem. The log file is probably encoded in something exotic like `T1`, but we try to read it using `utf-8`. This works as long as the log file only contains characters in the range 0-127, but might fail if the characters are in a different range.
The thing is, that I already tested the recent changes with logs containing unicode characters[1].
[1]: https://github.com/textmate/latex.tmbundle/blob/master/Tests/Log/%C3%BCnic%C...
The tests work fine for me. I also could not reproduce the errors you mentioned. I translated a file `unicöde.tex` with the following content:
\documentclass[a4paper, 12pt]{report} \usepackage{times}
\pdfmapfile{=mtpro2.map} \usepackage[mtphrb,subscriptcorrection,lite]{mtpro2}
\begin{document} $e^{i\cdot\pi}=-1$ \end{document}
I don't think it is a problem with the latex syntax, since the file seems to work in the modes described above.
You are most certainly right, the syntax is not the problem. Other users have the same problem too[2] :(
[2]: https://github.com/textmate/latex.tmbundle/issues/117
Any ideas?
For now a sample document that reproduces the error — on my machine — would be super helpful. Sorry again for the inconvenience.
Anthony
Kind regards, René
Hi guys, I did a TeX Live Utility “Update all packages”, as is my habit, opened up TextMate and sat down to work. Everything seems fine (no trouble producing PDF) except that ctrl-shift-h from the LaTeX bundle produces "Failure running “Tidy”” "Tidy: line 11: latexindent: command not found”. No harm done, so far as I can see, but the Tidy command is clearly not working for me. The bundles tab in preferences tells me that my LaTex bundle is 11h old, which would seem to indicate I’m working with the latest release…
As a “normal" (i.e kinda dumb) user, Is there something more I should be doing to care for my LaTeX bundle?
Robert
On 11 Feb 2015, at 13:01, René Schwaiger sanssecours@f-m.fm wrote:
Hi Allan,
On 11 Feb 2015, at 10:56 , Allan Odgaard mailinglist@textmate.org wrote:
On 11 Feb 2015, at 15:38, René Schwaiger wrote:
Can't locate YAML/Tiny.pm in @INC […]
[…] You need to install PYAML for the command to work.
Is it possible to place the YAML library in the bundle’s support folder and add that to perl’s include path?
I just did that in the latest commit [GitHub]. Thanks for the helpful suggestion.
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? The code I came up with:
{ # Try to run `latexindent` latexindent -c=/tmp "${TM_FILENAME}" } || { # `latexindent` failed. Most likely this was caused by `Tiny::YAML` not # being installed osascript -e "do shell script \"cpan App::cpanminus && cpanm YAML::Tiny\"\ with administrator privileges" > /dev/null || { exit_show_tool_tip "Could not install YAML::Tiny" } latexindent -c=/tmp "${TM_FILENAME}" }
has the problem, that there is no feedback for the installation process. Comments would be appreciated.
Kind regards,
René
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Hi Robert,
On 11 Feb 2015, at 23:50 , Robert Milton robert.gomez.milton@gmail.com wrote:
Hi guys, I did a TeX Live Utility “Update all packages”, as is my habit, opened up TextMate and sat down to work. Everything seems fine (no trouble producing PDF) except that ctrl-shift-h from the LaTeX bundle produces "Failure running “Tidy”” "Tidy: line 11: latexindent: command not found”. No harm done, so far as I can see, but the Tidy command is clearly not working for me. The bundles tab in preferences tells me that my LaTex bundle is 11h old, which would seem to indicate I’m working with the latest release…
As a “normal" (i.e kinda dumb) user, Is there something more I should be doing to care for my LaTeX bundle?
the only thing I can think of would be that you need to add `/usr/texbin` to your path. However, since “Typeset & View (PDF)” works for you that should already be the case.
As for the source of the error. Did you maybe not install the full MacTeX distribution, but only a smaller package? Could you please check if latexindent is installed by pasting the following command into Terminal.app:
/usr/texbin/latexindent
As I already mentioned to Anthony, I will try to fix the problem with the “Tidy” command after I get some sleep. Hopefully the issue should be fixed tomorrow, although technically speaking it is already “tomorrow” since one hour here.
Robert
Kind regards, René
Hi René, please get all the sleep you need, this isn’t urgent for me…aww I feel guilty now.
I ran /usr/texbin/latexindent and got: Can't locate YAML/Tiny.pm in @INC (@INC contains: /opt/local/lib/perl5/site_perl/5.16.1/darwin-thread-multi-2level /opt/local/lib/perl5/site_perl/5.16.1 /opt/local/lib/perl5/vendor_perl/5.16.1/darwin-thread-multi-2level /opt/local/lib/perl5/vendor_perl/5.16.1 /opt/local/lib/perl5/5.16.1/darwin-thread-multi-2level /opt/local/lib/perl5/5.16.1 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl .) at /usr/texbin/latexindent line 36. BEGIN failed--compilation aborted at /usr/texbin/latexindent line 36.
TeX Live Utility tells me that I have the latexindent package installed for darwin-universal but no other platforms. My LaTeX distribution is MacTeX2014.pkg dated 25 May 2014, updated via TeX Live Utility every couple of days ever since. I’d guess this is a default installation of the full MacTeX Live 2014 distribution. $PATH has certainly always contained `/usr/texbin`.
Please let me know if I can provide more info, if my response is slow it’s probably because I’m a bit of a night-owl.
Regards Robert
On 12 Feb 2015, at 00:14, René Schwaiger sanssecours@f-m.fm wrote:
Hi Robert,
On 11 Feb 2015, at 23:50 , Robert Milton robert.gomez.milton@gmail.com wrote:
Hi guys, I did a TeX Live Utility “Update all packages”, as is my habit, opened up TextMate and sat down to work. Everything seems fine (no trouble producing PDF) except that ctrl-shift-h from the LaTeX bundle produces "Failure running “Tidy”” "Tidy: line 11: latexindent: command not found”. No harm done, so far as I can see, but the Tidy command is clearly not working for me. The bundles tab in preferences tells me that my LaTex bundle is 11h old, which would seem to indicate I’m working with the latest release…
As a “normal" (i.e kinda dumb) user, Is there something more I should be doing to care for my LaTeX bundle?
the only thing I can think of would be that you need to add `/usr/texbin` to your path. However, since “Typeset & View (PDF)” works for you that should already be the case.
As for the source of the error. Did you maybe not install the full MacTeX distribution, but only a smaller package? Could you please check if latexindent is installed by pasting the following command into Terminal.app:
/usr/texbin/latexindent
As I already mentioned to Anthony, I will try to fix the problem with the “Tidy” command after I get some sleep. Hopefully the issue should be fixed tomorrow, although technically speaking it is already “tomorrow” since one hour here.
Robert
Kind regards, René
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate