Home Download Buy Blog Forum Support

Strange build script issue witch latex

Strange build script issue witch latex

Postby wassuup on Thu May 24, 2012 8:02 pm

Hi guys

I have encountered a strange problem on trying to set up a simple build script. I don't know if it's a bug, a fault of mine or a feature.

I wanted a simple script which just calls pdflatex on the currently editing file. So my script goes like this:

Code: Select all
{
   "cmd": ["pdflatex", "$file"],
   "file_regex": "^(...*?):([0-9]+): ([0-9]*)([^\\.]+)",
   "selector": "source.tex"
}


It's saved under sublime-text-2/Packages/User/LaTeX.sublime-build

It just doesn't work when editing .tex files (Pressing f7 or selecting build from the menu).
Strangely enough, it works on non .tex-files. E.g. if i have opened a file 'test.txt' and I press f7, pdflatex gets called on it (and generates an error, obviously):
Code: Select all
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
(/home/wassuup/Desktop/test.txt
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, ngerman, german, german-x-2009-06-19, ngerman-x-2009-06-19, loaded.


! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...                                             
                                                 
l.1 T
     hat's a test.
?
! Emergency stop.
...                                             
                                                 
l.1 T
     hat's a test.
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on test.log.
[Finished]


The only way to get it to work is to replace '$file' in the build file with the hardcoded name of the file I'm editing, E.g.
Code: Select all
{
   "cmd": ["pdflatex", "serie10.tex"],
   "file_regex": "^(...*?):([0-9]+): ([0-9]*)([^\\.]+)",
   "selector": "source.tex"
}


Naturally, this is not usable at all because I have to change it in the build script every time I edit another file. If build autodetect is on or off (I select LaTeX from the list manually then) doesn't matter.

Thanks in advance for your help!
wassuup
 
Posts: 5
Joined: Thu May 24, 2012 7:45 pm

Re: Strange build script issue witch latex

Postby wassuup on Tue May 29, 2012 6:36 pm

No one has a clue? It'd be really nice to know how to solve it, it's a really annoying thing...
wassuup
 
Posts: 5
Joined: Thu May 24, 2012 7:45 pm

Re: Strange build script issue witch latex

Postby arthuralvim on Sat Jun 02, 2012 12:02 am

Have you tried "selector": "text.tex.latex" ?

I made a Gist recently about some Bibtex compilation in Sublime Text 2.

https://gist.github.com/2852859

:)
arthuralvim
 
Posts: 2
Joined: Fri Jun 01, 2012 11:57 pm

Re: Strange build script issue witch latex

Postby quodlibet on Sat Jun 02, 2012 11:22 am

For the build systems to work automagically, you need to set it to "Automatic" (Tools > Build System > Automatic) and then use the correct selector in the various individual build systems. As @arthuralvim pointed out, the scope for latex files is "text.tex.latex". So you need to change the selector in your build system for LaTeX to this scope.

You can find out what the scope is for a syntax by opening an appropriate file (e.g., *.tex), hitting Ctrl+Shift+Alt+P and looking in the status bar. You can also inspect the appropriate tmLanguage file. E.g., Packages > LaTeX > LaTeX.tmLanguage, all the way at the bottom of the file.
quodlibet
 
Posts: 498
Joined: Sat Jun 18, 2011 5:53 pm

Re: Strange build script issue witch latex

Postby wassuup on Sun Jun 03, 2012 11:23 pm

Thanks for the information on the scope, i've changed it to 'text.tex.latex' now and the build script gets called corretly. However, id doesn't do anything and prints out the following error on the sublime text console:

Code: Select all
Traceback (most recent call last):
  File "./sublime_plugin.py", line 325, in run_
  File "./exec.py", line 124, in run
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 75: ordinal not in range(128)


This is a totally different error. The path of the .tex file im editing contains an 'ä' (Umlaut a, unicode 0xE4), and apparently sublime doesn't handle unicode args correctly when calling plugins/build scripts. So I guess this should be considered a bug?
wassuup
 
Posts: 5
Joined: Thu May 24, 2012 7:45 pm

Re: Strange build script issue witch latex

Postby Huge on Fri Oct 19, 2012 10:59 pm

It seems to be a bug, see those threads too:
viewtopic.php?f=3&t=7414
viewtopic.php?f=3&t=4465&p=38634#p38634
Huge
 
Posts: 3
Joined: Fri Oct 19, 2012 9:55 am


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], stupidideas and 24 guests