创建新列表环境,如何更改 \items 的长度

创建新列表环境,如何更改 \items 的长度

环境的代码如下,对于 \list item 中较长的行,我如何更改\items 的长度以使其与日期对齐?

基本上,我想要一种位于日期左侧的“边距”,但仅适用于列表 \items。我试过了,\newgeometry但它会更改整个页面并创建一个新页面。有什么想法吗?

类文件

\newenvironment{work}[3]{\WorkFont\WorkNameStyle #1 \hfill{}\normalsize\numberstyle #2
\\* \worklistfont\WorkDeatleStyle 
    \begin{list}{-}{#3 \vspace*{0.40em}}
}{
\end{list}\vspace*{1.0 em}}

TeX 文档

\begin{work}{Pennsylvania Governors School for the Sciences}{July 2007}{Physics TA/Counselor}
    \item{Taught concepts in relativistic physics to high school seniors}
    \item{Assisted project to build Wilberforce pendulum and documented findings}
    \item{Evaluated students’ progress throughout the program}
    \item{Encouraged intellectual thinking and social interaction between students}
\end{work}

它产生了一些看起来像的东西......

它生成一个包含“标题”和日期的列表

答案1

你可以尝试这样的事情

\newenvironment{work}[3]{%
#1\hfill #2\\*#3
\begin{list}{-}{%
\settowidth{\rightmargin}{#2}}}{%
\end{list}}

答案2

这是一种快速而粗略的tabularx方法,-第一列自动完成。列宽等只是猜测,字体命令也是如此。

\documentclass{article}

\usepackage{tabularx}

\newcommand{\WorkFont}{\bfseries}
\newcommand{\WorkNameStyle}{\upshape}
\newcommand{\numberstyle}{\scshape}
\newcommand{\worklistfont}{\itshape}
\newcommand{\WorkDeatleStyle}{}

\usepackage{array}

\newcolumntype{R}{>{-\arraybackslash}r}
\newcolumntype{I}[1]{>{\worklistfont\WorkDeatleStyle}p{#1}}

\newenvironment{work}[3]{%
  \tabularx{\linewidth}{RI{0.7\textwidth}X}
    \multicolumn{2}{p{0.7\textwidth}}{\WorkFont\WorkNameStyle #1} & \numberstyle #2 \tabularnewline
    \multicolumn{3}{c}{} \tabularnewline % Empty
  }{%
  \endtabularx%
}

\begin{document}
\noindent\begin{work}{Pennsylvania Governors School for the Sciences}{July 2007}{Physics TA/Counselor}
& Taught concepts in relativistic physics to high school seniors  \tabularnewline
&Assisted project to build Wilberforce pendulum and documented findings \tabularnewline
&Evaluated students’ progress throughout the program \tabularnewline
&Encouraged intellectual thinking and social interaction between students \tabularnewline
\end{work}
\end{document}

在此处输入图片描述

答案3

我建议您使用在以下帮助下定义的自定义列表enumitem还有一些\parboxes 包含每件作品的信息:

\documentclass[draft]{article}
\usepackage[T1]{fontenc}
\usepackage{enumitem}
\usepackage{calc}

\newcommand\WorkFont{\bfseries\raggedright}
\newcommand\WorkNameStyle{\upshape}
\newcommand\numberstyle{\scshape}
\newcommand\worklistfont{\itshape}
\newcommand\WorkDeatleStyle{}

\newlength\LongestDate

\newlist{Work}{itemize}{1}
\setlist[Work,1]{
  leftmargin=1cm,
  before=\setlength\rightmargin{\dimexpr\LongestDate+1em\relax},
  label={--}
}

\newenvironment{work}[3]
  {%
    \par\noindent
    \settowidth\LongestDate{\normalsize\numberstyle#2~}%
    \parbox[t]{\dimexpr\linewidth-\LongestDate-1em\relax}{%
      {\WorkFont\WorkNameStyle\raggedright #1}\par
      {\worklistfont\WorkDeatleStyle#3}
    }%
    \hfill
    \parbox[t]{\LongestDate}{%
      {\normalsize\numberstyle #2}%
    }  
    \par\nobreak
    \begin{Work}\raggedright
  }
  {\end{Work}\vspace{1.0 em}}

\begin{document}

\begin{work}{Pennsylvania Governors School for the Sciences and some more text}{July 2007}{Physics TA/Counselor}
    \item Taught concepts in relativistic physics to high school seniors
    \item Assisted project to build Wilberforce pendulum and documented findings
    \item Evaluated students' progress throughout the program
    \item Encouraged intellectual thinking and social interaction between students
\end{work}

\begin{work}{Pennsylvania Governors School for the Sciences and some more text}{October 2015}{Physics TA/Counselor}
    \item Taught concepts in relativistic physics to high school seniors
    \item Assisted project to build Wilberforce pendulum and documented findings
    \item Evaluated students' progress throughout the program
    \item Encouraged intellectual thinking and social interaction between students
\end{work}

\end{document}

在此处输入图片描述

相关内容