Hello
I try to create a latex template
I've no problem with the classic method [ NEW from Template] [Edit Templates] but with the other method
[ why another method ? Only God knows ..]
describes in the help of the bundle.
I create a file in Application Support > Latex > Templates but iI want to use shell variables like TM_FULLNAME TM_DATE TM_ORGANIZATION_NAME etc ...
I put %!TEX style = snippet at the beginning of my file and I' ve no problem with the variables except with TM_DATE.
I modify the ruby command "LaTeX Template" . I added inside the next line
ENV["TM_DATE"] = `date +%d-%m-%dY`.chomp
but it's not enough. What is wrong with my method?
Sorry if my question is stupid but I am a beginner with ruby and batch
Best Regards
Alain
Le 5 nov. 08 à 23:53, Alain Matthes a écrit :
Hello
I try to create a latex template
I've no problem with the classic method [ NEW from Template] [Edit Templates] but with the other method
[ why another method ? Only God knows ..]
describes in the help of the bundle.
I create a file in Application Support > Latex > Templates but iI want to use shell variables like TM_FULLNAME TM_DATE TM_ORGANIZATION_NAME etc ...
I put %!TEX style = snippet at the beginning of my file and I' ve no problem with the variables except with TM_DATE.
I modify the ruby command "LaTeX Template" . I added inside the next line
ENV["TM_DATE"] = `date +%d-%m-%dY`.chomp
but it's not enough. What is wrong with my method?
Hi
Perhaps my english language is not good enough ...
I read some questions and answers on the net but I don't have a solution
I can make this
in the latex template command
#!/usr/bin/ruby
require ENV['TM_SUPPORT_PATH'] + '/lib/osx/plist' require ENV['TM_SUPPORT_PATH'] + '/lib/exit_codes.rb' require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb' require ENV['TM_SUPPORT_PATH'] + '/lib/escape.rb'
ENV['TM_YEAR'] = `date +%Y`.chomp ENV['TM_DATE'] = `date +%Y-%m-%d`.chomp
DMY=ENV['TM_DATE'] puts(DMY)
etc ..
With a template file like this
%!TEX style = snippet
% Created by ${TM_FULLNAME} on ${TM_DATE}. % Copyright (c) ${TM_YEAR} ${TM_ORGANIZATION_NAME}. All rights reserved. etc ...
I get the date in my file with puts(DMY) but ${TM_DATE} gives nothing
I don't understand how to define the TM_DATE like a shell variable inside a ruby script.
Is it possible ?
Best Regards
Alain
On 5 Nov 2008, at 23:53, Alain Matthes wrote:
[...] no problem with the classic method [ NEW from Template] [Edit Templates] but with the other method
[ why another method ? Only God knows ..]
I seem to recall Haris saying that there already is an established convention for LaTeX templates, and the additiional system (specific to the LaTeX bundle) is for those who already have a lot of templates following this convention.
[...] I create a file in Application Support > Latex > Templates but iI want to use shell variables like TM_FULLNAME TM_DATE TM_ORGANIZATION_NAME etc ...
I don’t think it expands shell variables, and since this system is a more general LaTeX template system, I am not sure it really should be made to do so (i.e. it is there for compatibility).
Why not stay with snippets or regular templates?
Le 11 nov. 08 à 09:59, Allan Odgaard a écrit :
On 5 Nov 2008, at 23:53, Alain Matthes wrote:
[...] no problem with the classic method [ NEW from Template] [Edit Templates] but with the other method
[ why another method ? Only God knows ..]
I seem to recall Haris saying that there already is an established convention for LaTeX templates, and the additiional system (specific to the LaTeX bundle) is for those who already have a lot of templates following this convention.
[...] I create a file in Application Support > Latex > Templates but iI want to use shell variables like TM_FULLNAME TM_DATE TM_ORGANIZATION_NAME etc ...
I don’t think it expands shell variables, and since this system is a more general LaTeX template system, I am not sure it really should be made to do so (i.e. it is there for compatibility).
Why not stay with snippets or regular templates?
Yes i'm agree with you (I prefer regular templates ) but I'm curious about the problem :
How to define TM_DATE from a ruby script ?
another question is : how to make a command with two parts : a ruby script and a bash script ?
Best Regards
Alain Matthes
On 11.11.2008, at 15:07, Alain Matthes wrote:
another question is : how to make a command with two parts : a ruby script and a bash script ?
There're many possibilities.
one of them: -------------------------------------------- #!/usr/bin/env sh
echo "Now I'm in bash"
# RET is set be invoking Ruby RET=$(cat <<-RUBY | /usr/bin/ruby -
a = [1,2,3]
p "Ruby: #{a.inspect}"
RUBY)
# return to bash echo "$RET"
--HansJ
On Nov 11, 2008, at 9:07 AM, Alain Matthes wrote:
Le 11 nov. 08 à 09:59, Allan Odgaard a écrit :
On 5 Nov 2008, at 23:53, Alain Matthes wrote:
[...] no problem with the classic method [ NEW from Template] [Edit Templates] but with the other method
[ why another method ? Only God knows ..]
I seem to recall Haris saying that there already is an established convention for LaTeX templates, and the additiional system (specific to the LaTeX bundle) is for those who already have a lot of templates following this convention.
[...] I create a file in Application Support > Latex > Templates but iI want to use shell variables like TM_FULLNAME TM_DATE TM_ORGANIZATION_NAME etc ...
I don’t think it expands shell variables, and since this system is a more general LaTeX template system, I am not sure it really should be made to do so (i.e. it is there for compatibility).
Why not stay with snippets or regular templates?
Yes i'm agree with you (I prefer regular templates ) but I'm curious about the problem :
The intent of the LaTeX templates was for repeatable code snippets, that can be inserted as part of a document. It was mostly there for people migrating from TeXShop, if I remember correctly. Then again it was a long time ago. One can really think of them as regular snippets probably, except that in their present form they can be directly shared with other TeX programs that use them, if I recall correctly.
Alain Matthes
Haris Skiadas Department of Mathematics and Computer Science Hanover College