TransWikia.com

Should I place my preamble on a .tex file or on a .sty file

TeX - LaTeX Asked by crazytelli on December 22, 2020

I’m writing my thesis and have decided to place my preamble with packages and custom new commands and macros in there in order to have a cleaner main.tex file.

I have placed my preamble in a file named mypreamble.sty.

Is this best practice to write a .sty?

It compiles as expected and no errors are shown.

Should I place my preamble on a preamble.tex and call it with input{preamble.tex}?

Here’s a minimal working example:

usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[brazil]{babel}
usepackage{titlesec}

titleformat{chapter}[hang]
{normalfontbfserieslarge}
{thechapter}
{0.5em}
{MakeUppercase}
[]
titlespacing{chapter}{0em}{*2}{*2}[0em]
.
.
.

And on my main.tex I simply call it with

documentclass[a4paper,12pt, article]{memoir}
usepackage{mypreamble}
begin{document}
My thesis.
end{document}

One Answer

.sty is fine, and what I usually suggest but it makes no difference other than you need makeatletter if you use commands with @ in the input form.

Correct answer by David Carlisle on December 22, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP