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.

The command \hfill align to right, but if i want to align to the left what command i must use?

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Multi-Purpose Large Font
% LaTeX Template
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author:
% Frits Wenneker (http://www.howtotex.com)
%
% This template can be used in one of two ways:
%
% 1) Content can be added at the end of this file just before the \end{document}
% to use this title page as the starting point for your document.
%
% 2) Alternatively, if you already have a document which you wish to add this
% title page to, copy everything between the \begin{document} and
% \end{document} and paste it where you would like the title page in your
% document. You will then need to insert the packages and document 
% configurations into your document carefully making sure you are not loading
% the same package twice and that there are no clashes.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[11pt]{article}

\usepackage[a4paper,pdftex]{geometry}   % Use A4 paper margins
\usepackage[english]{babel}
\usepackage{xcolor} % Required for specifying custom colors
\usepackage{fix-cm} % Allows increasing the font size of specific fonts beyond LaTeX default specifications

\setlength{\oddsidemargin}{0mm} % Adjust margins to center the colored title box
\setlength{\evensidemargin}{0mm} % Margins on even pages - only necessary if adding more content to this template

\newcommand{\HRule}[1]{\hfill \rule{0.2\linewidth}{#1}} % Horizontal rule at the bottom of the page, adjust width here

\definecolor{grey}{rgb}{0.9,0.9,0.9} % Color of the box surrounding the title - these values can be changed to give the box a different color   

\begin{document}

\thispagestyle{empty} % Remove page numbering on this page

%----------------------------------------------------------------------------------------
%   TITLE SECTION
%----------------------------------------------------------------------------------------
\begin{flushleft}
flush left\\
\colorbox{grey}{
    \parbox[t]{1.0\linewidth}{
        \centering \fontsize{50pt}{80pt}\selectfont % The first argument for fontsize is the font size of the text and the second is the line spacing - you may need to play with these for your particular title
        \vspace*{0.7cm} % Space between the start of the title and the top of the grey box

        \hfill \LaTeX \\
        \hfill Title \\
        \hfill Template\par

        \vspace*{0.7cm} % Space between the end of the title and the bottom of the grey box
    }
}

%----------------------------------------------------------------------------------------

\vfill % Space between the title box and author information

%----------------------------------------------------------------------------------------
%   AUTHOR NAME AND INFORMATION SECTION
%----------------------------------------------------------------------------------------

{\large 
\hfill John Smith \\
\hfill University Name \\
\hfill Department Name \\
\hfill \texttt{http://www.johnsmith.com} \\

\HRule{1pt}} % Horizontal line, thickness changed here
\end{flushleft}
%----------------------------------------------------------------------------------------

\clearpage % Whitespace to the end of the page

\end{document}
share|improve this question
9  
That's not the meaning of \hfill. Please show more clearly what you need to accomplish. –  egreg Jun 2 '12 at 12:50
3  
You are confused. \hfill has no left or right preference. Can you give a more detailed explanation of what you are trying to accomplish? –  Harald Hanche-Olsen Jun 2 '12 at 12:50
6  
Oh, now the question was edited. Perhaps the answer is this: Just put \hfill to the right of the thing you want to align, rather than to its left? But only context can show if this is the right answer. –  Harald Hanche-Olsen Jun 2 '12 at 12:52
    
@all i have added the code ! i want to put all to left ! i want also to ask you why the left margin is bigger then the right margin.. Thanks ! :) –  FormlessCloud Jun 3 '12 at 15:02
    
Why are you using \centering if you want everything to the left? \begin{flushleft}...\end{flushleft} is what you seem to need. –  egreg Jun 3 '12 at 15:06
show 1 more comment

1 Answer

up vote 12 down vote accepted

As noted in the comments \hfill doesn't have a left or right preference

 \noindent aaa \hfill bbb

aaa is pushed to the left and bbb is pushed to the right equally.

Normally though you don't want this at all but something like

\begin{flushright}
flush right\\
text
\end{flushright}


\begin{flushleft}
flush left\\
text
\end{flushleft}
share|improve this answer
    
@Tobi, thanks :-) –  David Carlisle Jun 2 '12 at 19:09
1  
Your welcome. Maybe you’d like to add a few word’s about \raggedright/\raggedleft?! –  Tobi Jun 2 '12 at 21:40
add comment

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.