Theses, Books, Title pagesWhere to define document-wide definitions

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
Post Reply
Corned Beef Hash
Posts: 5
Joined: Thu Oct 15, 2015 5:26 pm

Where to define document-wide definitions

Post by Corned Beef Hash »

I am attempting to create a document-wide definition for my Master's Thesis:
\DeclareSIUnit\micron{\micro\meter} which uses the SIunitx package. I am not able to place this definition at the head of Ch. 1, and can't find a suitable place for it in the main.tex, or Thesis.cls files. According to the SIunitx documentation the \DeclareSIUnit command must be placed in the preamble of the document.

I am using the \DeclareSIUnit because the \def command doesn't allow for variable spacing. For example, if I use \def \mu {\micro m} and then type '5 \mu diameter', the output is '5 mudiameter'. Conversely, if I use \def \mu {\micro m{}} and then type '5\mu.' the output is '5 mu .'

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

Where to define document-wide definitions

Post by Stefan Kottwitz »

Welcome to the forum!
Corned Beef Hash wrote:I am not able to place this definition at the head of Ch. 1, and can't find a suitable place for it in the main.tex, or Thesis.cls files.
It should not be in a chapter, neither at its beginning. You said it should go to the preamble, which is correct. This means, it comes before \begin{document}. Furthermore, it should be after the siunitx package has been loaded. So it could be written right after \usepackage{siunitx}.

A .cls file should never be changed, except if you are the author. One reason is, that there's immediately incompatibility to the original class. Find the preamble and use it. Sometimes a preamble inputs a file with settings, such as \input{macros}, then this file can be used for changes.

Stefan
LaTeX.org admin
Corned Beef Hash
Posts: 5
Joined: Thu Oct 15, 2015 5:26 pm

Re: Where to define document-wide definitions

Post by Corned Beef Hash »

That did the trick, thanks. I had a lot of packages in the .sty file for some reason, as soon as I moved them over to the main.tex file everything worked.
Post Reply