GeneralMaintaining the Source Consistency

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Maintaining the Source Consistency

Post by Cham »

I'm writing a huge book on physics, of about 1200 pages and 20 chapters, since about two years now.
I'm expecting to finish it in about a year from now.

I'm still discovering LaTeX tricks and adjustments with time, so my document is evolving constantly.

What troubles me is the way I'm now writing equations isn't the same as the way I was writing them one year ago. So I constantly have to redo lots of "old" equations, just to maintain some coherence in the whole document. I'm losing time just to check the first chapters and compare them with the notation in the last chapters. :evil: :(

Let me ask a stupid question : what are you doing to maintain coherence while writing a large LaTeX document ? Do you have any "tricks" or "special method" ? Any comment on this ?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10347
Joined: Mon Mar 10, 2008 9:44 pm

Maintaining the Source Consistency

Post by Stefan Kottwitz »

It's good because it shows there's significant improvement during the writing process.

My tip is: define your own macros and use them whenever you can, even for a small purpose. This way you can have a consistent document even if you would improve and change: you just need to change the macros in your preamble which has effect on the whole document.

For example, I noticed font commands such as \rm, \mathscr etc. in your code. Don't use them this way! Instead, define logical names and use them. They should be macros, defined in your preamble. So you don't need to change the whole document just because you decided to change \mathscr to \mathcal or \rm to \mathrm.

Stefan
LaTeX.org admin
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Maintaining the Source Consistency

Post by cgnieder »

Cham wrote:Let me ask a stupid question : what are you doing to maintain coherence while writing a large LaTeX document ? Do you have any "tricks" or "special method" ? Any comment on this ?
This is not a stupid question at all! Many LaTeX introductions unfortunately don't stress enough what Stefan said: the use of own commands to maintain a semantically logic markup in the text so that all design decisions are only made in the preamble (or even an own package file specific to the document at hand). For example: never use \textit and other font related commands in the text but define a command to reflect the nature of the italicized content. Say you want to have names in italics do something like the following:

Code: Select all

% preamble:
\newcommand*\name[1]{\textit{#1}}
% document:
\name{Albert Einstein}
So if you later decide you want the names in sans serif instead or not specially formatted at all you only change the definition:

Code: Select all

\newcommand*\name[1]{\textsf{#1}}
% or
\newcommand*\name[1]{#1}
The same principle holds for mathematical entities like vectors or matrices, and what else you can think of...

Regards
site moderator & package author
Post Reply