-1

I did a fresh install on a MacBook Pro, and installed Mavericks, MacTex, Textmate and Texlive.

I am trying to work with some LaTex documents and I get this error on build:

undefined method `+' for nil:NilClass (NoMethodError).

In previous uses I did not see this error.

Below is the script I think I need to tweak but I do not know how. I found guidance in "Ruby undefined method `+' for nil:NilClass (NoMethodError)", but it does not appear to be applicable.

I am also suspicion of the MacTex download via Chrome, I checked that it was ok in Terminal, ran a checksum, and it was, but the MacTex site advises against using Chrome.

Script with a "problem:"

#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
# coding: utf-8

require ENV["TM_SUPPORT_PATH"] + "/lib/tm/process"
require ENV["TM_SUPPORT_PATH"] + "/lib/tm/htmloutput"
require ENV["TM_SUPPORT_PATH"] + "/lib/tm/save_current_document"

# To enable the typesetting of unsaved documents, you must change the “Save” setting of
# this command to “Current File” and add the variable TM_LATEX_AUTOSAVE to TextMate's
# Shell Variables preferences. Be warned that your document must be encoded as UTF-8 if
# you excercise this option — becauseTextMate.save_current_document cannot know the file
# encoding you prefer.

TextMate.save_current_document unless ENV["TM_LATEX_AUTOSAVE"].nil?

texMate = ENV["TM_BUNDLE_SUPPORT"] + "/bin/texMate.py"
engine_version = TextMate::Process.run(texMate, "version")
TextMate::HTMLOutput.show(:title => "Typesetting “#{ENV["TM_DISPLAYNAME"] || File.basename(ENV["TM_FILEPATH"])}”…", :sub_title => engine_version) do |io|
  TextMate::Process.run(texMate, 'latex', '1', :interactive_input => false) do |line|
    io << line
  end
end
::Process.exit($?.exitstatus || 0) # exitstatus is nil if our process is prematurely terminated (SIGINT)

Any help would be great, thanks.

Community
  • 1
  • 1
user36146
  • 11
  • 1
  • 1
    You fail to tell us which LINE is generating that error. You have multiple `+` in your script, so it could be any of them. Run your code, look at the line number, and then open the code in your editor. Go to that line and you'll know which `ENV` variable wasn't set. This is debugging 100, not even 101. – the Tin Man Jan 13 '14 at 14:47
  • Thanks, Making my way from 100 to 101 then, – user36146 Jan 14 '14 at 01:28

3 Answers3

1

The error you received happens when you try to use the method + on nil:

nil + 'something'

In your code the '+' sign appears in 4 places:

require ENV["TM_SUPPORT_PATH"] + "/lib/tm/process"
require ENV["TM_SUPPORT_PATH"] + "/lib/tm/htmloutput"
require ENV["TM_SUPPORT_PATH"] + "/lib/tm/save_current_document"

...
texMate = ENV["TM_BUNDLE_SUPPORT"] + "/bin/texMate.py"

Which means that one of either ENV["TM_SUPPORT_PATH"] or ENV["TM_BUNDLE_SUPPORT"] returns nil.

The ENV construct reflects the content of your machine's environment variables, therfore you should make sure the environment variables TM_SUPPORT_PATH and TM_BUNDLE_SUPPORT are set.

Uri Agassi
  • 36,848
  • 14
  • 76
  • 93
0

Problem solved. I deleted Textmate and then relied on Hazel to delete all affiliated files. I used TexLive to update all packages, ... just an overhaul. Following Mactex guidance using Safari for all future downloads, including the new download of Textmate, Installed Textmate, then followed this guidance, How and "Why to use TextMate for LaTeX," by Kelle, http://www.astrobetter.com/how-and-why-to-use-textmate-for-latex/#comment-595219 ... by the way excellent blog for help with Teaching. I then did a restart, which may not be necessary. Works wonderfully. I cannot comment on the value of the tweaking above, Red Herrings abound, the extent of the absenteeism may have indicated the initial installation was off (a guess). Thanks

user36146
  • 11
  • 1
0

I had a similar problem, all the builts stoped working after I cleaning up some bundles that I do not need and installing some new ones. The solution was that I deinstalled the Bundle "Bundle Support", even if it says "no not uninstall" in the description.

Reactivating "Bundle Support" solved this issue for me.

Chilichiller
  • 477
  • 1
  • 5
  • 15