我正在制定一个竞赛问题清单,它看起来应该是这样的:
Problem 1. Some text
5 points As the text continues it stays aligned
to this
|<--
|<--
Invisible line
Problem 2. More text
1 point also aligned
我想使用类似枚举的环境,例如
\newenvironment{questions}{
\begin{list}{
\bfseries\upshape\arabic{qcounter}.
}{
\renewcommand{\makelabel}[1]{%
\textbf{\refstepcounter{qcounter}\arabic{qcounter}##1.}}%
\usecounter{qcounter}
\setlength{\labelwidth}{2.5em}
\setlength{\labelsep}{0.5em}
\setlength{\leftmargin}{\labelwidth+\labelsep}
\setlength{\itemsep}{2pt}
\setlength{\listparindent}{1em}
\setlength{\parsep}{1pt}
\setlength{\topsep}{6pt}
}
}{
\end{list}
}
我已将续订更改makelabel
为
\renewcommand{\makelabel}[1]{%
\textbf{\refstepcounter{qcounter}Problem \arabic{qcounter}##1.}\\##1 points}
但没用。我也试过把它放进去minipage
,但放进去之后项目的文本看起来很奇怪。
我还想给出item
论据:点数和结尾或单词点,例如point##2
,因为我用俄语写作,单词的结尾会根据数字发生很大变化。
有没有什么选项可以让我制作这样的清单?
我的代码(LuaLaTeX):
\documentclass[10pt,landscape]{extarticle}
\usepackage[top=1cm, bottom=1cm, left=0.25in, right=0.25in]{geometry}
\pagestyle{empty}
\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000
\usepackage{ragged2e}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{comment}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{wrapfig}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usepackage{skull}
\usepackage{faktor}
\usepackage{xfrac}
\usepackage{enumitem}
\usepackage{lipsum}
%
\usepackage{multicol}
\usepackage{tabularx}
\setlength\tabcolsep{0pt}
\setlength{\columnsep}{1cm}
\setlength{\columnseprule}{0.4pt}
%
\usepackage[russian]{babel}
\usepackage{mathptmx}
\usepackage{polyglossia}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Times New Roman}
\newfontfamily\cyrillicfont{Times New Roman}
\usepackage{mathrsfs}
\setmainlanguage{russian}
\newcounter{qcounter}
\newenvironment{questions}{
\begin{list}{
\bfseries\upshape\arabic{qcounter}.
}{
\renewcommand{\makelabel}[1]{%
\textbf{\refstepcounter{qcounter}\arabic{qcounter}##1.}}%
\usecounter{qcounter}
\setlength{\labelwidth}{2.5em}
\setlength{\labelsep}{0.5em}
\setlength{\leftmargin}{\labelwidth+\labelsep}
\setlength{\itemsep}{2pt}
\setlength{\listparindent}{1em}
\setlength{\parsep}{1pt}
\setlength{\topsep}{6pt}
}
}{
\end{list}
}
\begin{document}
\begin{questions}
\item[1] \lipsum[1]
\item[2] \lipsum[2]
\end{questions}
\end{document}
答案1
\usepackage{calc}
\newcounter{qcounter}
% Item parameter is number of points.
% See The LaTeX Companion, Second Edition, page 150.
\newcommand{\questionlabel}[1]{%
\refstepcounter{qcounter}\raisebox{0pt}[1ex][0pt]%
{\makebox[\labelwidth][l]%
{\parbox[t]{\labelwidth}%
{\hspace{0pt}\textbf{Problem \arabic{qcounter}}\\#1 points}}}}
\newenvironment{questions}
{\begin{list}{}{\let\makelabel\questionlabel
\setlength{\itemsep}{2pt}
\setlength{\listparindent}{1em}
\setlength{\parsep}{1pt}
\setlength{\topsep}{6pt}
\settowidth{\labelwidth}{\textbf{Problem 99}}%
\setlength{\labelsep}{0.5em}%
\setlength{\leftmargin}{\labelwidth+\labelsep}%
\usecounter{qcounter}}
}
{
\end{list}
}