我正在起草简历,我想对我做过的项目、会议等进行编号,但顺序要倒着来(即:最新的项目编号最高,并位于列表顶部)。我找到了一个按行计数的代码和一个按枚举的代码,但我似乎找不到一个在多行上反向工作的代码。
我想要的是基本上三列{C{2m} L{8.5cm} R{6cm}
。下面是我用来控制 LaTex 的一些代码:
\documentclass[a4paper,10.5pt]{article}
\usepackage[english]{babel}\usepackage[utf8]{inputenc}
\usepackage{garamondx}
\usepackage{blindtext}
%tabular
\usepackage{adjustbox}
\newcounter{rowcount}
\setcounter{rowcount}{0}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\begin{document}
\subsubsection*{Conferences}
%row count
\adjustbox{bgcolor=white, tabular=@{\stepcounter{rowcount}\makebox[3em][r]{\color{black}\therowcount.)}\hspace*{\tabcolsep}}>{\color{black}}l>{\color{black}}l}
{%
National Conference on Undergraduate Research (NCUR). Memphis, TN.& April 2017.
\\
McNair National Research Conference. Delavan, WI. October &2016.
\\
TRIO Graduates School Retreat and Seminar. Delavan, October &2016
\\
Regional Materials and Manufacturing Network Conference. Menomonie, WI. &Spring 2016.
\\
Biotechnology and Molecular Biology On-Site Seminars. Madison, WI.& March 2015.
\\}
%manual enumerate
\begin{enumerate}
\item[5] new
\item[4] aged
\item[...] old
\item[1] ancient
\end{enumerate}
%Table
\begin{tabular}{| C{2cm} | L{4cm} | R{4cm} |}
no &
Thing &
Date \\
\end{tabular}
\end{document}
答案1
通过“利用”总行数(正在查询\getrefnumber
)和当前行计数器值之间的线性映射来实现这种可能性。
使用
f(x) = -x + N + 1
将当前行号映射到反转位置,因为N
标记了总行数。
这是通过 完成的\the\numexpr\getrefnumber{thelastrowcount}+1 - \value{rowcount}
,前提是\thelastrowcount
是放在表格后面的有效标签。
对于这种方法,我必须制作一个不会在表格单元格组中丢失的假标签,即使用\protected@xdef\@currentlabel
。
\documentclass[a4paper,10.5pt]{article}
\usepackage[english]{babel}\usepackage[utf8]{inputenc}
%\usepackage{garamondx}
\usepackage{blindtext}
%tabular
\usepackage{adjustbox}
\newcounter{rowcount}
\setcounter{rowcount}{0}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{array}
\usepackage{refcount}
\makeatletter
\newcommand{\fakelabel}[1]{%
\protected@xdef\@currentlabel{#1}%
}
\makeatother
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\begin{document}
\subsubsection*{Conferences}
%row count
\adjustbox{bgcolor=white, tabular=@{\refstepcounter{rowcount}\fakelabel{\therowcount}\makebox[3em][r]{\color{black}\the\numexpr\getrefnumber{thelastrowcount}+1 - \value{rowcount}.)}\hspace*{\tabcolsep}}>{\color{black}}l>{\color{black}}l}
{%
National Conference on Undergraduate Research (NCUR). Memphis, TN.& April 2017.
\\
McNair National Research Conference. Delavan, WI. October &2016.
\\
TRIO Graduates School Retreat and Seminar. Delavan, October &2016
\\
Regional Materials and Manufacturing Network Conference. Menomonie, WI. &Spring 2016.
\\
Biotechnology and Molecular Biology On-Site Seminars. Madison, WI.& March 2015.
\\ }
\label{thelastrowcount}
%manual enumerate
\begin{enumerate}
\item[5] new
\item[4] aged
\item[...] old
\item[1] ancient
\end{enumerate}
%Table
\begin{tabular}{| C{2cm} | L{4cm} | R{4cm} |}
no &
Thing &
Date \\
\end{tabular}
\end{document}
更新所需表
\documentclass[a4paper,10.5pt]{article}
\usepackage[english]{babel}\usepackage[utf8]{inputenc}
%\usepackage{garamondx}
\usepackage{blindtext}
%tabular
\usepackage{adjustbox}
\newcounter{rowcount}
\setcounter{rowcount}{0}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{array}
\usepackage{refcount}
\makeatletter
\newcommand{\fakelabel}[1]{%
\protected@xdef\@currentlabel{#1}%
}
\makeatother
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{N}[2]{>{\raggedleft\refstepcounter{rowcount}\fakelabel{\therowcount}\makebox[3em][r]{\color{black}\the\numexpr\getrefnumber{#1}+1 - \value{rowcount}.)}\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#2}}
\begin{document}
\subsubsection*{Conferences}
%row count
\adjustbox{bgcolor=white, tabular=@{\refstepcounter{rowcount}\fakelabel{\therowcount}\makebox[3em][r]{\color{black}\the\numexpr\getrefnumber{thelastrowcount}+1 - \value{rowcount}.)}\hspace*{\tabcolsep}}>{\color{black}}l>{\color{black}}l}
{%
National Conference on Undergraduate Research (NCUR). Memphis, TN.& April 2017.
\\
McNair National Research Conference. Delavan, WI. October &2016.
\\
TRIO Graduates School Retreat and Seminar. Delavan, October &2016
\\
Regional Materials and Manufacturing Network Conference. Menomonie, WI. &Spring 2016.
\\
Biotechnology and Molecular Biology On-Site Seminars. Madison, WI.& March 2015.
\\ }
\label{thelastrowcount}
%manual enumerate
\begin{enumerate}
\item[5] new
\item[4] aged
\item[...] old
\item[1] ancient
\end{enumerate}
%Table
\begin{tabular}{| N{foocount}{2cm} | L{4cm} | R{4cm} |}
\multicolumn{1}{|C{2cm}|}{no} &
Thing &
Date \tabularnewline
&National Conference on Undergraduate Research (NCUR). Memphis, TN.& April 2017.
\tabularnewline
&McNair National Research Conference. Delavan, WI. October &2016.
\tabularnewline
&TRIO Graduates School Retreat and Seminar. Delavan, October &2016
\tabularnewline
&Regional Materials and Manufacturing Network Conference. Menomonie, WI. &Spring 2016.
\tabularnewline
&Biotechnology and Molecular Biology On-Site Seminars. Madison, WI.& March 2015.
\end{tabular}\label{foocount}
\end{document}
答案2
我不确定其\adjustbox
用途是什么,所以我用了标准tabular
。
\documentclass[a4paper]{article}
\usepackage[textwidth=16.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{garamondx}
\usepackage{array}
\usepackage{refcount}
\newcounter{rowcount}
\newcounter{cvcount}
\newenvironment{cvdata}
{%
\par\noindent
\stepcounter{cvcount}%
\setcounter{rowcount}{0}%
\edef\thiscvdatacount{\getrefnumber{cvdata@\thecvcount}}%
\begin{tabular}{
@{\stepcounter{rowcount}\cvdataitem}
p{12.5cm}
@{}
>{\raggedleft\arraybackslash}p{3cm}
@{}
}%
}
{%
\end{tabular}%
\refstepcounter{rowcount}\label{cvdata@\thecvcount}%
}
\newcommand{\cvdataitem}{%
\makebox[1cm][r]{%
\the\numexpr\thiscvdatacount-\value{rowcount}\relax.)\enspace
}%
}
\begin{document}
\subsubsection*{Conferences}
\begin{cvdata}
National Conference on Undergraduate Research (NCUR). Memphis, TN.& April 2017
\\
McNair National Research Conference. Delavan, WI. October &2016
\\
TRIO Graduates School Retreat and Seminar. Delavan, October &2016
\\
Regional Materials and Manufacturing Network Conference. Menomonie, WI. &Spring 2016
\\
Biotechnology and Molecular Biology On-Site Seminars. Madison, WI.& March 2015
\end{cvdata}
\end{document}
这个想法是在环境结束时设置一个标签cvdata
,并在稍后的编译中进行必要的计算。