Using an underscore with the SetDirectory command works fine.

SetDirectory["D:\\at_work\\mathematica\\programming_maeder"]


Now I can load a package using Get["ComplexMap"] or Needs["ComplexMap"].

But if I set the directory to the directory above

SetDirectory["D:\\at_work\\mathematica"]


The Get or Needs commands fails.

Get["programming_maederComplexMap"]


Since it is within a string I would have thought the above statement would work. Is there a way to use the underscore here?

A workaround is to rename the directory programmingMaeder but I would prefer to use the underscore.

• You can either rename the directory and use the backtick notation or keep the directory name and use the normal path syntax of your operating system, i.e. Get["D:\\at_work\\mathematica\\programming_maeder\\ComplexMap.m"]. The idea behind the backtick notation is that users will be able to simply write the package context after << to load the package. This requires the context name to agree with the directory and file names. Context names simply cannot contain underscores. – Szabolcs Feb 11 '15 at 15:19
• have you tried the Get[name,Path->{}] form? – george2079 Feb 11 '15 at 17:56
• The Get command with the complete path suggested by Szabolcs works fine. Also the form suggested by george2079 works. Thank you both – Jack LaVigne Feb 11 '15 at 23:58

The comment given by Szabolcs works as an answer. He suggested using:

Get["D:\\at_work\\mathematica\\programming_maeder\\ComplexMap.m"]


He also made it clear that one is not allowed to use an underscore in a Context name.

The comment given by george2079 also works as an answer. He suggested using:

Get["ComplexMap",
Path -> {"D:\\at_work\\mathematica\\programming_maeder"}]


or

Get["ComplexMap.m",
Path -> {"D:\\at_work\\mathematica\\programming_maeder"}]


I hope I am doing the correct thing by taking their comments and posting them as an answer.

• that's appropriate. Go ahead and accept it after a while. – george2079 Feb 13 '15 at 20:41