textmate / latex.tmbundle

TextMate support for LaTeX
97 stars 64 forks source link

Failure running “LaTeX Template”. #189

Closed ondohotola closed 2 years ago

ondohotola commented 2 years ago

When I attempt to insert a LaTeX Template into an otherwise empty file, on Monterery 12.1 on both x86_64 and arm64 I get the error

Failure running “LaTeX Template”.

/Users/el/Library/Application Support/TextMate/Managed/Bundles/LaTeX.tmbundle/Support/lib/Ruby/command.rb:423:in `template_text': uninitialized constant OSX (NameError)
from /Users/el/Library/Application Support/TextMate/Managed/Bundles/LaTeX.tmbundle/Support/lib/Ruby/command.rb:430:in `insert_template'
from LaTeX Template:9
rbenit68 commented 2 years ago

https://github.com/textmate/latex.tmbundle/issues/187

Please include the following line inside command.rb import section:

require ENV['TM_SUPPORT_PATH'] + '/lib/osx/plist'

otherwise the OSX variable cannot be set and the template selector will not trigger.
ondohotola commented 2 years ago

Works,

thank you.

el

AlainMatthes commented 2 years ago

When I attempt to insert a LaTeX Template into an otherwise empty file, on Monterery 12.1 on both x86_64 and arm64 I get the error

Failure running “LaTeX Template”.

/Users/el/Library/Application Support/TextMate/Managed/Bundles/LaTeX.tmbundle/Support/lib/Ruby/command.rb:423:in `template_text': uninitialized constant OSX (NameError)
from /Users/el/Library/Application Support/TextMate/Managed/Bundles/LaTeX.tmbundle/Support/lib/Ruby/command.rb:430:in `insert_template'
from LaTeX Template:9

With which version of TextMate? No problem with 2.0.17 but problem with 2.0.23 for me

juandesant commented 2 years ago

Changed it LaTeX.tmblundle/Support/lib/Ruby/command.rb, and now the UI for selecting each of the templates is fine. However, it seems something else is broken in my environment (macOS 12.6), because why I get as output is something like this:

["\t\t\t% !TEX TS-program = xelatex\n", "\t\t\t%\n", "\t\t\t% Created by Juande Santander-Vela on date: illegal time format usage: date [-jnRu] [-r seconds|file] [-v[+|-]val[ymwdHMS]] [-I[date | hours | minutes | seconds]] [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format].\n", "\t\t\t% Copyright (c) date: illegal time format usage: date [-jnRu] [-r seconds|file] [-v[+|-]val[ymwdHMS]] [-I[date | hours | minutes | seconds]] [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format] .\n", "\t\t\t\documentclass[addpoints]{exam}\n", "\t\t\t\n", "\t\t\t\usepackage{polyglossia}\n", "\t\t\t\n", "\t\t\t\firstpageheader{Course}{Exam}{Page \thepage\ of \numpages}\n", "\t\t\t\firstpageheadrule\n", "\t\t\t\n", "\t\t\t\begin{document}\n", "\t\t\t\n", "\t\t\t\begin{center}\n", "\t\t\t \fbox{\parbox{0.9\textwidth}{\centering\n", "\t\t\t Answer the questions in the spaces provided on the\n", "\t\t\t question sheets. If you run out of room for an answer,\n", "\t\t\t continue on the back of the page.}}\n", "\t\t\t\end{center}\n", "\t\t\t\n", "\t\t\t\vspace{0.5cm}\n", "\t\t\t\makebox[0.9\textwidth]{Name:\enspace\hrulefill}\n", "\t\t\t\n", "\t\t\t\begin{questions}\n", "\t\t\t\question[5] First question\n", "\t\t\t\end{questions}\n", "\t\t\t\n", "\t\t\t\end{document}\n", "\t\t\t"]

juandesant commented 2 years ago

See also Issue #187.

juandesant commented 2 years ago

Don't mind this: it seems it was the result of having also changed the actual TextMate command to use /usr/bin/env ruby instead of /usr/bin/env ruby18. Restoring the LaTeX bundle to the latest released, and then adding the require ENV['TM_SUPPORT_PATH'] + '/lib/osx/plist' at the beginning of LaTeX.tmblundle/Support/lib/Ruby/command.rb does indeed resolve the issue.

Changed it LaTeX.tmblundle/Support/lib/Ruby/command.rb, and now the UI for selecting each of the templates is fine. However, it seems something else is broken in my environment (macOS 12.6), because why I get as output is something like this:

["\t\t\t% !TEX TS-program = xelatex\n", "\t\t\t%\n", "\t\t\t% Created by Juande Santander-Vela on date: illegal time format usage: date [-jnRu] [-r seconds|file] [-v[+|-]val[ymwdHMS]] [-I[date | hours | minutes | seconds]] [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format].\n", "\t\t\t% Copyright (c) date: illegal time format usage: date [-jnRu] [-r seconds|file] [-v[+|-]val[ymwdHMS]] [-I[date | hours | minutes | seconds]] [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format] .\n", "\t\t\t\documentclass[addpoints]{exam}\n", "\t\t\t\n", "\t\t\t\usepackage{polyglossia}\n", "\t\t\t\n", "\t\t\t\firstpageheader{Course}{Exam}{Page \thepage\ of \numpages}\n", "\t\t\t\firstpageheadrule\n", "\t\t\t\n", "\t\t\t\begin{document}\n", "\t\t\t\n", "\t\t\t\begin{center}\n", "\t\t\t \fbox{\parbox{0.9\textwidth}{\centering\n", "\t\t\t Answer the questions in the spaces provided on the\n", "\t\t\t question sheets. If you run out of room for an answer,\n", "\t\t\t continue on the back of the page.}}\n", "\t\t\t\end{center}\n", "\t\t\t\n", "\t\t\t\vspace{0.5cm}\n", "\t\t\t\makebox[0.9\textwidth]{Name:\enspace\hrulefill}\n", "\t\t\t\n", "\t\t\t\begin{questions}\n", "\t\t\t\question[5] First question\n", "\t\t\t\end{questions}\n", "\t\t\t\n", "\t\t\t\end{document}\n", "\t\t\t"]