Home » Questions » Computers [ Ask a new question ]

Text to the right of a \section{title} in LaTeX (the normal case is, text comes below) [closed]

Text to the right of a \section{title} in LaTeX (the normal case is, text comes below) [closed]

I use LaTeX, but I only consider myself an average user. I have a special need. If I have a \section{Something} and I would like { something else } on the same vertical line as the section. But aligned right. How would I go about doing that?

Asked by: Guest | Views: 301
Total answers/comments: 2
Guest [Entry]

"If you only want to do this once... don't. Find some other way to present that single bit of information. \hfil[l][l] will work, but it can play havoc with the Table of Contents if you're not careful, and in general you just shouldn't go there.

If you want to add a little bit of extra information to every section title, or even most of them, you're going to have to hack the sectioning commands. You'll probably end up declaring some kind of \customsection[Optional ToC text]{Section title}{Extra information you want on the right side} command. If you can, use the titlesec package; it will save you a lot of time."
Guest [Entry]

"Use \hfill .

\section{Something \hfill something else}

Note, that answer your requirement for appearance, I'm not too sure whether you only want ""Something"" considered as part of the title, because the above solution consider ""Something something else"" as the title."