\hfill 无法到达页面末尾的问题

\hfill 无法到达页面末尾的问题

我是新手,需要创建一个类文件来维护简历的特定格式。我包含了我正在使用的模板中的所有代码,以防止出现任何编译问题。

我试图使用 \hfill 将日期排列在页面的最末端,但 LaTex 不允许我这样做,我也不知道为什么。我提供了示例代码,如果不清楚,可以编辑问题。谢谢!

主文本

\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:[email protected]}{[email protected]} \\ \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}

部分/firstsection.tex

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

简历.cls

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

我想要的输出位于图像底部的分隔处,职位名称位于左侧部分,日期位于右侧部分的最末端。 https://i.stack.imgur.com/STTfI.png

图像底部的所需输出

答案1

段落结尾有\parfillskip平衡,\hfill你可以结束段落而不跳过

\newenvironment{rSubSectionWork}[2]{%
  #1 \hfill #2{\parfillskip=0pt\par}%
}

注意%

\\每次使用该命令后,都删除。

小心添加虚假空间,你正在添加大量坏空间

例如

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

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

您需要% 在行的末尾。

    \def \\ {\addressSep\ }

定义\\SPACE的形式意味着\\如果后面没有文字空格字符则会产生错误。

相关内容