Text FormattingTrouble with \hfill not going to the end of the page.

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
nbosio1001
Posts: 1
Joined: Fri Dec 31, 2021 6:17 pm

Trouble with \hfill not going to the end of the page.

Post by nbosio1001 »

I am new at creating a class file to maintain a specific format for my resume.
I am trying to line up my dates at the very end of the page using \hfill, but LaTex is not letting me and I have no idea why. I included sample code and can edit the question if it isn't clear. Thanks!

main.tex

Code: Select all

\documentclass[11pt,a4paper]{resume} % Use the custom resume.cls style
\usepackage[left=0.4 in,top=0.4in,right=0.4 in,bottom=0.4in]{geometry}
\usepackage{titlesec}
\usepackage{subfiles}

\name{Random Name} % Your name
% % if you do not have a website, sub your github instead.
\address{(111) 111-1111 \\ San Antonio, CA} 
\address{\href{mailto:randomemail@gmail.com}{randomemail@gmail.com} \\ \href{https://www.linkedin.com/in/random/}{https://www.linkedin.com/in/random/} \\ \href{https://github.com/random}{https://github.com/random}}

\begin{document}
    \rSection{Example Title}
    \subfile{sections/firstsection}
\end{document}
sections/firstsection.tex

Code: Select all

\documentclass[../main.tex]{subfiles}
\begin{document}
\rSubSectionWork{Math tutoring for living, Company Education Services}{Mar 2021 - Present}
\begin{itemize}
    \setlength\itemsep{0pt}
    \item Provide tutoring and technical support for students in the Fintech Bootcamp. iuiuniuniuniuniu
    \item This is sentence one with a lot of text for me to test this out please.
    \item More text that will include everythgin and anything for a long time because ai will be the future of the test and they will increase the funding for the thing.
\end{itemize}
\rSubSectionWork{R\&D Engineering Technician, Amazon website}{Jan 2019 - Mar 2019}\\
\rSubSectionWork{Project Contributor, Goldman Sachs grouphhnhh}{Sept 2015-June 2016}
\end{document}
resume.cls

Code: Select all

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Medium Length Professional CV - RESUME CLASS FILE
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% This class file defines the structure and design of the template. 
%
% Original header:
% Copyright (C) 2010 by Trey Hunner
%
% Copying and distribution of this file, with or without modification,
% are permitted in any medium without royalty provided the copyright
% notice and this notice are preserved. This file is offered as-is,
% without any warranty.
%
% Created by Trey Hunner and modified by www.LaTeXTemplates.com
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ProvidesClass{resume}[2010/07/10 v0.9 Resume class]

\LoadClass[11pt,letterpaper]{article} % Font size and paper type

\usepackage[parfill]{parskip} % Remove paragraph indentation
\usepackage{array} % Required for boldface (\bf and \bfseries) tabular columns
\usepackage{ifthen} % Required for ifthenelse statements
% \setlist[itemize,1]{noitemsep, topsep=0pt}

\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,      
    urlcolor=black,
}

\pagestyle{empty} % Suppress page numbers

%----------------------------------------------------------------------------------------
%	HEADINGS COMMANDS: Commands for printing name and address
%----------------------------------------------------------------------------------------

\def \name#1{\def\@name{#1}} % Defines the \name command to set name
\def \@name {} % Sets \@name to empty by default

\def \addressSep {$\diamond$} % Set default address separator to a diamond

% One, two or three address lines can be specified 
\let \@addressone \relax
\let \@addresstwo \relax
\let \@addressthree \relax

% \address command can be used to set the first, second, and third address (last 2 optional)
\def \address #1{
  \@ifundefined{@addresstwo}{
    \def \@addresstwo {#1}
  }{
  \@ifundefined{@addressthree}{
  \def \@addressthree {#1}
  }{
     \def \@addressone {#1}
  }}
}

% \printaddress is used to style an address line (given as input)
\def \printaddress #1{
  \begingroup
    \def \\ {\addressSep\ }
    \centerline{#1}
  \endgroup
  \par
  \addressskip
}

% \printname is used to print the name as a page header
\def \printname {
  \begingroup
    \hfil{\MakeUppercase{\namesize\bf \@name}}\hfil
    \nameskip\break
  \endgroup
}

%----------------------------------------------------------------------------------------
%	PRINT THE HEADING LINES
%----------------------------------------------------------------------------------------

\let\ori@document=\document
\renewcommand{\document}{
  \ori@document  % Begin document
  \printname % Print the name specified with \name
  \@ifundefined{@addressone}{}{ % Print the first address if specified
    \printaddress{\@addressone}}
  \@ifundefined{@addresstwo}{}{ % Print the second address if specified
    \printaddress{\@addresstwo}}
     \@ifundefined{@addressthree}{}{ % Print the third address if specified
    \printaddress{\@addressthree}}
}

%----------------------------------------------------------------------------------------
%	SECTION FORMATTING
%----------------------------------------------------------------------------------------

% Defines the rSection environment for the large sections within the CV
\newenvironment{rSection}[1]{ % 1 input argument - section name
  \colorbox{black}{\makebox[\textwidth][l]{\MakeUppercase\bfseries\color{white} #1}}\\ % Section title
}

\newenvironment{rSubSection}[1]{ 
  \textbf{#1}
}

\newenvironment{rSubSectionWork}[2]{ 
  #1 \hfill #2
}

% ATTEMPTED TO SET UP A ENVIRONMENT
\newenvironment{resumeitem}[1]{
  \begin{list}
    \item{#1}
  %  \newline
  % \vspace{-2pt}
  \end{list}
}


%   \sectionlineskip
%   \hrule % Horizontal line
%   \begin{list}{}{ % List for each individual item in the section
%     \setlength{\leftmargin}{0em} % Margin within the section
%   }
%   \item[]
% }{
%   \end{list}
% }

% % SECTION FORMATTING 
% \RequirePackage[nostruts]{titlesec}
% \titlespacing*{\section}{0em}{0.5em}{0em}
% \titleformat{\section{\colorbox{}{}{}{}{\color{black} \scshape \raggedright \large}{}{0em}{}[\vspace{-0.75em}\hrulefill]


%----------------------------------------------------------------------------------------
%	WORK EXPERIENCE FORMATTING
%----------------------------------------------------------------------------------------

% \newenvironment{rSubsection}[4]{ % 4 input arguments - company name, year(s) employed, job title and location
%  {\bf #1} \hfill {#2} % Bold company name and date on the right
%  \ifthenelse{\equal{#3}{}}{}{ % If the third argument is not specified, don't print the job title and location line
%   \\
%   {\em #3} \hfill {\em #4} % Italic job title and location
%   }\smallskip
%   \begin{list}{$\cdot$}{\leftmargin=0em} % \cdot used for bullets, no indentation
%   \itemsep -0.5em \vspace{-0.5em} % Compress items in list together for aesthetics
%   }{
%   \end{list}
%   \vspace{0.5em} % Some space after the list of bullet points
% }

% \newenvironment{rSubsection}



% The below commands define the whitespace after certain things in the document - they can be \smallskip, \medskip or \bigskip
\def\namesize{\LARGE} % Size of the name at the top of the document
\def\addressskip{\smallskip} % The space between the two address (or phone/email) lines
\def\sectionlineskip{\medskip} % The space above the horizontal line for each section 
\def\nameskip{\medskip} % The space after your name at the top
\def\sectionskip{\medskip} % The space after the heading section

% \newenvironment{rSection}[9001]
% \section*{\colorbox{black}{\makebox[\textwidth-2\fboxsep][l]{\bfseries\color{white} Education}}}

My desired output is at the separation at the bottom of the image with the job title at the left section and the dates at the very end of the right section.
https://i.stack.imgur.com/STTfI.png
Attachments
testing.zip
(3.3 KiB) Downloaded 181 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Trouble with \hfill not going to the end of the page.

Post by Stefan Kottwitz »

Hi Nick,

welcome to the forum!

No problem with cross-posts, but you should add a link then. It was already solved by David Carlisle with the suggestion

Code: Select all

\newenvironment{rSubSectionWork}[2]{%
  #1 \hfill #2{\parfillskip=0pt\par}%
}
for removing the skip at the end of a paragraph.

Without a link (or my information here) some readers may still try to help by downloading the zip file and spending time etc. Next time just add a link to the other forum so we can see if it's already done, thanks.

Stefan
LaTeX.org admin
Post Reply