4

Following an answer on my previous question about creating a default preamble, I tried to create a custom template in TexStudio using the commands file-->make template.

Even though the template is saved in .config/template subfolder (I am using Ubuntu 14.04), I cannot load it by using the commands file-->new from template.

In other words, TexStudio finds only default templates (article, book, koma-script, etc).

So my question is how to say to TexStudio to load my custom template?

Johannes_B
  • 24,235
  • 10
  • 93
  • 248
Yorgos
  • 2,694
  • I have no problems with this (in Linux Mint if that matter). The user templates are stored in ~/.config/texstudio/templates/user and should be one template_yourtemplate.tex and one template_yourtemplate.json. – Fran Dec 23 '15 at 10:39
  • In that folder I have one file template_yourtemplate.json and another template_yourtemplate.sty. I don't know if .sty causes the problem. I will try to convert it in .tex file – Yorgos Dec 23 '15 at 10:46
  • Ok! The problem is solved. As it proved, .sty format caused the problem. – Yorgos Dec 23 '15 at 10:52
  • 2
    while this may work for you, there is a significant difference between .sty and .tex files that may cause problems for someone else. if a file contains any command name in which an @ sign appears, the .sty file will automatically recognize it, but in a .tex file, the affected code must be surrounded by \makeatletter ... \makeatother to be handled properly. so, in general, .tex and .sty files are not interchangeable. – barbara beeton Dec 23 '15 at 14:59
  • As I understand TeXstudio templates, as stated there needs to be 2 files placed into ~/.config/texstudio/templates/user, your_template.json (defines author, date, and files to open) and your_template.zip (which contains the tex files to be opened when creating). – ozhank Aug 28 '16 at 03:51

1 Answers1

0

After you save the template in File > Make Template... with information like Name, Author, Version, Description and License, you select the option File > New From Template... With that, it will open a Select LaTeX Template tab. So, just choose the custom template you saved in User. Now if your question is how to do this by command, I don't know the answer. Also, I don't know if this option is compatible with other versions of TeXstudio. The one I have is 2.12.6.

  • As you may read in my description, the problem (for me) was that I could not access my saved template, because for some reason TeXStudio could not recognise .sty format. Once I converted to a .tex file, then your solution worked – Yorgos Feb 17 '22 at 15:39