Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I need help with this. Why Block B is being printed below Block A? I need to have it right to Block A.

\documentclass[10pt]{article} % Font size - 10pt, 11pt or 12pt.

\usepackage[hmargin=1.25cm, vmargin=1.5cm]{geometry} % Document margins.

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\rfoot{{\sffamily Last update: \today}}

\renewcommand{\headrulewidth}{0pt} % Get rid of the default rule in the header.

\begin{document}

\begin{minipage}[t]{0.5\textwidth} % Start the left-hand side of the page.
\vspace{0pt} % Trick for alignment.
Block A.
\end{minipage} % End the left-hand side of the page.

\hfill % ----------------------------------------------------------------------

\begin{minipage}[t]{0.44\textwidth} % Start the right-hand side of the page.
\vspace{0pt} % Trick for alignment.
Block B.
\end{minipage} % End right-hand side of the page.

\end{document}
share|improve this question

1 Answer 1

\documentclass[10pt]{article} % Font size - 10pt, 11pt or 12pt.

\usepackage[hmargin=1.25cm, vmargin=1.5cm]{geometry} % Document margins.

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\rfoot{{\sffamily Last update: \today}}

\renewcommand{\headrulewidth}{0pt}% Get rid of the default rule in the header.

\begin{document}

\noindent
\begin{minipage}[t]{0.5\textwidth}% Start the left-hand side of the page.
Block A.
\end{minipage}% End the left-hand side of the page
\hfill % ----------------------------------------------------------------------
\begin{minipage}[t]{0.44\textwidth}% Start the right-hand side of the page.
Block B.
\end{minipage}% End right-hand side of the page.

\end{document}

I have moved the spaces before your % as these will produce unwanted white space in the output, I removed the paragraph breaks between the minipages and removed the vspace "trick" which would prevent the minipages aligning on the baseline of their first row.

share|improve this answer
    
I need to say that minipage have strange behaviour. Should I go for columns instead of minipage? Or maybe there is some better solution? –  Teddy Feb 10 '13 at 17:36
    
minipage are just positioned the same way a letter is positioned they really don't have any behaviour at all strange or otherwise. You haven't given much indication of the intention of the layout but using twocolumn mode or a table are possibilities depending what you need. –  David Carlisle Feb 10 '13 at 17:41
    
I need to make two columns on one page AND I don't want to bother about that I have wrong formatting (spaces) that can screw up all my work. –  Teddy Feb 10 '13 at 17:47
1  
why one column wider than the other? In TeX you always have to worry about spaces, then input AB and the input A B are different: white space in the source may produce white space in the output. –  David Carlisle Feb 10 '13 at 17:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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