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.

Tags: , , ,

Related Posts:

  • Installing LaTex on Windows
  • LaTex: Fixing Wrong Figure Numbers
  • Latex: Rotate Inserted Images
  • Latex: Numbered Subsubsections
  • Code Segments in Latex
  • Convert JPG and PNG to EPS on Windows
  • LaTex: Making Floatng Text Boxes
  • The case of the switch
  • Latex Conditionals
  • Homeworks From Hell

  • 14 Responses to “LaTex Annoyances”

    1. Gravatar Lee UNITED STATES 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.

      Posted using Mozilla Firefox Mozilla Firefox 1.5.0.8 on Windows Windows XP
    2. Gravatar Luke UNITED STATES Says:

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

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

      Posted using Mozilla Firefox Mozilla Firefox 2.0 on Windows Windows XP
    3. Gravatar Michael Shell UNITED STATES Says:

      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.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.1 on Linux Linux
    4. Gravatar Luke UNITED STATES Says:

      Thanks! This thing was driving me nuts!

      Posted using Mozilla Firefox Mozilla Firefox 2.0 on Ubuntu Linux Ubuntu Linux
    5. Gravatar Michael Shell UNITED STATES Says:

      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.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.1 on Linux Linux
    6. Gravatar Luke UNITED STATES 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. )

      Posted using Mozilla Firefox Mozilla Firefox 2.0 on Ubuntu Linux Ubuntu Linux
    7. Gravatar Surajit Das INDIA Says:

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

      Posted using Internet Explorer Internet Explorer 6.0 on Windows Windows XP
    8. Gravatar Luke UNITED STATES Says:

      Surajit - try this:

      \renewcommand\bibname{References}

      This should do the trick.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.5 on Windows Windows XP
    9. Gravatar Surajit Das INDIA Says:

      Many many thanks Luke, it worked!

      Posted using Internet Explorer Internet Explorer 6.0 on Windows Windows XP
    10. Gravatar Luke UNITED STATES Says:

      Glad to help. )

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.5 on Windows Windows XP
    11. Gravatar Surajit Das INDIA Says:

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

      Posted using Internet Explorer Internet Explorer 6.0 on Windows Windows XP
    12. Gravatar Luke UNITED STATES Says:

      Not sure what you mean. Can you explain?

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.2 on Ubuntu Linux Ubuntu Linux
    13. Gravatar Surajit Das INDIA 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.

      Posted using Internet Explorer Internet Explorer 6.0 on Windows Windows XP
    14. Gravatar Luke Maciak UNITED STATES 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.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.6 on Windows Windows XP

    Leave a Reply

    XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <pre lang=""> <em> <i> <strike> <strong>

    [Quote selected]