I have recently found that I don’t have to alter my base .tex files when I write a report, take notes etc like I use to. I’d like to upload them on a repo since at this point I think they might actually be of help to somebody.

I have been using LaTeX for a few years started on Lyx, moved on to Overleaf and finally I now use Texmaker. All this to say I am not overly familiar with styles/classes etc. Is there any standard practices I sould know when sharing a template? Do i need to seperate the preable for example? Is there anything like a requirements.txt file for the packages? Or is a single .tex file the norm? I’d like to have something usable up for anyone that might run into the same issues.

  • IndependentComb257@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Making your own style file that essentially just consolidates (most of) your preamble into a separate file would be a traditional place to start (but if you’re looking to share on Overleaf via their “template” system, those are often just gutted files with lots of comments—a completely different experience).

    Overleaf has a decent intro to writing a style file.

    In LaTeX itself, there’s not a direct analog to a python requirements.txt file. Generally it’s assumed that folks are either using TeXLive (and therefore has [nearly] all the packages submitted to CTAN). You can (and should) specify the minimum version of packages when loading which will generate warnings for anyone who tries to compile it with packages that are too old. The date is provided at the top of each package’s style file, like \ProvidesPackage{geometry}[2020/01/02 v5.9 Page Geometry]

    So then to ensure someone is using a sufficiently new version of geometry, you would then specify:

    \usepackage{geometry}[2020/01/02]

    Or in a custom style or class file, you’d use:

    \RequirePakcage{geometry}[2020/01/02]

    And so if someone then tries to compile this with TeXLive 2018 (for example), their log would warn them that they are using an outdated version of geometry (but it won’t stop compilation, so if the older version happens to be compatible they can still use it).

    • PerfectParanoia@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      I am thinking of just just having a repository with the “templates” I find myself using, so not sharing on Overlead right now. What seems a bit off to me is that I would expext style files to drastically impact the appearance of the document whereas most of what packages I have used, mainly, adds functionality that may be useful in math/cs/statistics. Or in some cases makes using my native language easier with some latin focused packages.

      Right now I have mainly what you describe as gutted files with comments. If I understand correctly, typically I would to use a .sty file in which I would I just move everything over, ideally with \RequirePakcage{foopack}[version used]. Thanks fot taking the time to write this out, I had read the overleaf intro but dismissed most of it as more package centric.