# Problem Using \hfill to Justify Text [duplicate]

This question already has an answer here:

I am writing a resume using the scrartcl,currvita, and classicthesis packages. Everything else is fine but I have run into a problem correctly justifying some dates along the right side of the page. When I use the command '\NewEntry', as defined below, it leaves a small white space of about 0.5em at the right side of the page, even though I have used /hfill. If I add the line manually instead of using a function, it does not do this, as shown in the picture. I have attached all of the code that I think is relevant. Can someone explain to me why it is doing this? Obviously I could just hand code it every time or correct it with /hspace(-0.5em) but I would much prefer to use a function.

\documentclass[11pt]{scrartcl}
\reversemarginpar % Move the margin to the left of the page

\usepackage[nochapters]{classicthesis}
\usepackage[LabelsAligned, NoDate]{currvita}
\usepackage{marginnote}
\usepackage{color}

\usepackage[letterpaper,top=0.35in, bottom=0.15in, left=1.5in, right=0.5in,marginparwidth=1in,marginparsep=0.25in]{geometry}

\newcommand{\NewEntry}[2]{\raggedright\noindent\hangindent=2em\hangafter=0 \textsc{\bf#1}  {\hfill\small\textit{#2}}
% Define a command for each new block - change spacing and font sizes here
\vspace{0.15em}} % Add some white space after each new entry

\begin{document}

\pdfpageheight 11in
\pdfpagewidth 8.5in

\thispagestyle{empty} % Stop the page count at the bottom of the first page

\begin{cv}{}

---------------

\NewEntry{University of the Pacific}{Expected May 2016}

\raggedright\noindent\hangindent=2em\hangafter=0 \textsc{\bf University of the Pacific} \hfill {\small\textit{Expected May 2016}}

\end{cv}

\end{document}


## marked as duplicate by jon, Masroor, Paul Gessler, Jesse, Werner spacing StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jan 23 '15 at 3:50

• Off-topic: don't use \bf - it was deprecated 20+ years ago. More on topic: usually, you would use \raggedleft or the flushright environment (from ragged2e?) to set text right, rather than forcing it with \hfill. – cfr Jan 23 '15 at 1:15
• You have {\hfill\small\textit{#2}} , which is adding space at the end of the line; change it to {\hfill\small\textit{#2}}%. (This is surely a duplicate of some more general question. This question seems to link to several.) – jon Jan 23 '15 at 2:20