与 \hfill 命令相反

与 \hfill 命令相反

命令\hfill对齐到右,但是如果我想对齐到左,我必须使用什么命令?

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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}

答案1

正如评论中指出的那样,\hfill没有左或右的偏好

 \noindent aaa \hfill bbb

aaa被同样地推向左边和bbb推向右边。

通常情况下,你根本不想要这个,但是

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


\begin{flushleft}
flush left\\
text
\end{flushleft}

相关内容