Closed cristobaltapia closed 7 years ago
In principle, this should be doable. However, if you import the template into a new buffer, vim does not know where you are going to save that file. What should be done in this case?
But the copying of such files is not necessary, if you set the TEXINPUTS
environment variable. This variable does contain a list of folders, in which latex looks for files (and images). Therefore, I recommend to set this variable and you do not need to copy any files while using a template.
You really got me with the new buffer problem. I am not sure, but normally you would create a file with the extension tex
in order to get the vim-latex-suite functionality: :e path/to/file/new_file.tex
. In doing so, the directory should be defined (the directory given to open the new file). If a new buffer is opened without specifying a new file (:new
) then the vim-latex-suite plugin wont be activated, therefore it wont be possible to call :TTemplate
.
In the case where the plugin is already activated (because another *.tex file has been opened), maybe an alternative would be to explicitly ask the user, if the files should be copied, like this:
The template you are importing uses additional files. What should be done with them?
1: copy to current directory
2: don't copy (write location of files as a comment in the file to later manually copy)
Regarding the use of TEXINPUTS
, I would rather not use it, since the things I write might be opened by someone else, who might not have the same files in his/her environment variable. That is why I prefer to copy the needed files to the same folder.
But somebody else has to have your templates in his template directory. Hence, (s)he can also add the template directory to the TEXINPUTS
variable. And it is better to have all files only once (and this is facilitated by TEXINPUTS
), otherwise one would have to distribute the changes.
Hence, I do not see a strong demand for this functionality.
Not necessarily (and that is the point). I can have my templates and another person could have their own templates. You only use the :TTemplate
command once (at the beginning of your document) and then it doesn't matter that you used it. You don't even have to have vim-latex-suit nor vim. All you need is a latex compiler to modify the document. That is why I think such a functionality could be interesting. It helps that the documents are self-contained in one folder (except for the CTAN packages everybody uses).
Not necessarily (and that is the point). I can have my templates and another person could have their own templates.
But if you want to use another person's templates, you have to copy them to your template directory. Hence, if you want to use it once, you can similarly copy the necessary files directly to your document's directory, and if you want to use it regularly, the necessary files should be in your TEXINPUTS
.
(I am already not happy that templates can execute arbitrary commands. Maybe I will add an option to disable this safety issue feature.)
I think, I am having difficulties to explain myself. I don't want to use other person's templates, but rather be able to compile a *.tex file that another person created based on a template. So, for example, if I create a new file with :TTemplate
I would like that someone using another system can compile it without problems, too. And I mean compile the file that already exists, not a new one with the same template. I understand that TEXINPUTS
is a reasonable solution, but I just feel uncomfortable about using it at work, when you are not sure if it will be clear for other people what they need to do to compile the file correctly. Maybe it is really not that important (for some reason I imagine that someone would like to compile my files in 20 years and it needs to work hahaha). I will just add the path to my TEXINPUT
for now.
(I really don't use the feature of the arbitrary command execution, so I wouldn't oppose to that :P)
Let me describe what I am doing in such a situation.
I compile my tex
files with latexmk
(I do not use the compile feature of latex-suite). This creates a file *.fdb_latexmk
containing all the dependencies. Then, you can crawl through that file to look for dependencies which do not reside in the usual tex-tree. Since the *.fdb_latexmk
is sorted, this can be done fairly quick.
I use latexmk
too, but I didn't know that. That is a good solution. Thanks!
A template very often has one or more external files associated to it, like for example a logo or some custom document class. It would be very useful if vim-latex-suite could know which files are associated to which template (maybe write them in the header of the template file, (see below)) and then copy them to the working directory when
:TTemplate
is called.The template file could look something like this:
Would this be doable?