# LaTex Annoyances

I really like LaTex. I much prefer to typset my papers, rather than manufacture them in word. But every once in a while, I find little things that make using LaTex a PITA.

For example, in my document, I have text that often needs to be repeated. For example, I need the title on the titlepage (duh), the copyright page, the signature page and etc… Same goes for actor. I spent countless hours searching how to extract data from the built in variables initialized via the standard \author and \title calls. I even emailed my old mentor in all things LaTex and he also had no clue.

So I decided to fake it:

\newcommand{\printtitle}{Title of My Paper}

Now wherever I need to put title, I just use \printtitle and I’m done. This is not a perfect solution, but it works. At least as long as you don’t start nesting functions. For example if you do:

\uppercase{\printtitle}

You get lowercase letters. Why? Latex does not have a proper stack, and so nesting functions may or may not work depending on circumstances. At least that’s what I have been told.

This is annoying as shit. Anyone knows the proper way to do this? I know that the answer must be locked up somewhere deap within article.cls which includes the implementation of the \maketitle call. But for the life of me, I can’t decipher how to extract title and author from there.

This entry was posted in programming and tagged . Bookmark the permalink.

### 14 Responses to LaTex Annoyances

1. Lee says:

Regarding your title problem, this will get you the text:

\makeatletter\@title\makeatother

but it still barfs if you try to use \uppercase

hope this helps.

2. Luke says:

Wow! Thanks for the tip! I couldn’t figure that out.

I’m wondering if \protect will do anything in this case…

3. Use the LaTeX rather than the TeX form:

\MakeUppercase{\printtitle}

and it will be in uppercase. ;)

Another command to know is TeX’s \edef which expands the definition before it is stored. However, as with \def, you have to be careful as it will not warn you if an existing command is overwritten.

4. Luke says:

Thanks! This thing was driving me nuts!

5. I forgot to mention one more trick. This:

\expandafter\uppercase\expandafter{\printtitle}

will also work. All of this is related the problem of how far TeX should expand a macro before performing an operation on it. It isn’t so much a design flaw or limitation of TeX, but rather a difficulty in specifying to it exactly what you want to do. Obviously, \uppercase, unlike \MakeUppercase, does not do an expansion on its argument before it operates on it.

6. Luke says:

Thanks! Those are really great tips.

See, sometimes I miss this kind of insights – I have functional understanding of LaTex but every once in a while I run into a problem that reminds me that I still have tons to learn about it. :)

7. Surajit Das says:

I want to write the Heading: “References” in place of “Bibliography” for the heading of Bibliography. How can i do that?

8. Luke says:

Surajit – try this:

\renewcommand\bibname{References}

This should do the trick.

9. Surajit Das says:

Many many thanks Luke, it worked!

10. Luke says:

11. Surajit Das says:

I dont want to put the page number of the bibliography in the content of my report. How can i do that?

12. Luke says:

Not sure what you mean. Can you explain?

13. Surajit Das says:

Can i use the “.sty” files while i am in windows Xp platform? If so, then how can i do that? I want to use the Sty files such as fancyheadings.sty, nomencl.sty etc.

14. Luke Maciak says:

Why wouldn’t you? If you have a fancy custom style you can just drop it in the same directory as the file you are working on. If you want to install a package for a system wide use you should probably consult instructions for your latex distribution as the paths may vary.