I am having a hard time positioning text. Especially if I need to 'float' elements to different sides. Currently, I'm trying to show a header with a 'subheader' that should be to the right of the header. Exactly to the right; not under it, not above it. Something like this:
MAIN TITLE SUB TITLE
And here goes all the text, over the full page width.
The sub title should be exactly where the content box
ends, no matter what the size of the main title, nor
what the size of the sub title.
ANOTHER LONGER MAIN TITLE ANOTHER SUBTITLE
This is another set of titles that shows just exactly
that the text subtitle should jump to the right of the
page, no matter the size.
I've tried many things but can not get this done. My closest fix was something like this:
\documentclass[11pt]{article}
\usepackage{parskip}
\usepackage{blindtext}
\begin{document}
\newcommand{\subtitle}[1]{\fbox{\vbox to 0pt{\hbox to 12.8cm{\hfill {#1}}}}}
\newcommand{\maintitle}[1]{\noindent\emph{#1 \vspace{0.01in}}}
\fboxsep0pt
\subtitle{Subtitle}
\maintitle{Title}
\blindtext
\subtitle{And a longer subtitle}
\maintitle{A longer title}
\blindtext
\end{document}
And this is what it looks like:

My problems are the following:
- In order to prevent that the position of the box is being influenced by the title, I need to actually put it before the title (so subtitle precedes title). This feels semantically wrong.
- Whatever I do, I can not get it to align at the same line. Always, whatever I put first pushes the other text down, even though it is a little bit.
- Creating a
\hfillin an\hboxin an\vboxin an\fboxlooks too complicated if I just want to float this box to the right. This should be easier, or not...?
What is the right way to tackle this issue?

MWEstands for...? (I understand it refers to the OP sample code, but what do the letters mean?) – user Feb 21 '12 at 12:58