0

I am in the initial stages of writing my thesis (Maths). I once wrote a joint paper with someone and because they had an existing template we used it, with all the latex macros it had. Basically there were so many macros that I would have to repeatedly go, look and find the macro for the symbols. When I programme (c, python) I just give the variables full names, instead of calling a variable r, or rem, I just use the full word remainder for example. I just need someone to tell me that they wrote their thesis without any macros so that I can get on with the job. I have been deciding for the past 5 hours what macros to have and what to call them. But I do not want to use them.

What are some good choices one can make with writing latex code? With programming there are ones like, write comments to clarify, write code that matches the symbols and names in the equations as much as possible.

  • You can begin without using macros at all, until you find yourself typing the same text or code repeatedly. Then you can write a macro which expands to that text or code to save typing. Later, you'll probabaly realize that some code constructs can be generalized and parametrized, and then you'll want to write macro with parameters. In addition, macros are specially useful to enforce consistency in notation and typography. Think of them as "styles" for some parts of your text. Of course you can name your macros any way you want. There is no penalty for long names. – JLDiaz May 26 '14 at 9:22
  • Btw, I don't understand this question title – JLDiaz May 26 '14 at 9:23
  • @JLDiaz s/me/mn/g – Joseph Wright May 26 '14 at 9:30
  • I misspelt damn but apparently dame means a beautiful women. – user1318806 May 26 '14 at 9:41
  • 2
    You can (should) edit your title, but not just to fix the miss-spelling (which makes it impossible to guess what the question is about) But to actually make it relate to your question. (It is very hard to tell what your question is, probably something about asking for good coding practice). – David Carlisle May 27 '14 at 8:35
5

You might find it useful to take a look at the best-practices tag for "good choices" others have suggested, such as commenting your code liberally, spacing out code to make it more readable and so on. With regard to the specific things you mention:

  • there's no reason beyond brevity to use short macro names over long ones; if you find you're using something frequently you might find that \remainder makes code harder to read than \rem, but that's up to you. Using a full term is certainly less ambiguous.
  • there are definitely some cases where macros are advisable; if you are using a particular symbol or formatting to convey some notion (ie you are using it semantically), having code that reflects that means your code is more legible, and you can easily adjust your notation later if needs be.

You don't need to work out every macro you're going to use right at the start, though. When you're about to type something for which a macro would be appropriate, add a definition to the preamble and then use it. There's no sense in trying to predict now how your thesis will turn out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.