我正在尝试获取:
1. text text text
2. text text text
2*. text text text
3. text text text
4. text text text
4*. text text text
我见过类似的事情:
\newcommand{\myitem}{\refstepcounter{enumi}\item[\theenumi\up{*}.]}
这里 。然而,这并不是我想要实现的。
编辑。天啊,你们太棒了!!!如果我能在交叉验证堆栈中获得尽可能多的响应,我将在一周内完成我的论文;)
答案1
标签最右边最好对齐。在前言中定义\newcommand{\myitem}{\item[$\vphantom{x}^{*}$\theenumi]}
和使用。\setlist[enumerate,1]{leftmargin=*, label=\arabic*.}
\documentclass[]{report}
\usepackage{enumitem}
\newcommand{\myitem}{\item[$\vphantom{x}^{*}$\theenumi]}
\setlist[enumerate,1]{leftmargin=*, label=\arabic*.}
\begin{document}
\begin{enumerate}
\item Item 1
\item Item 2
\myitem Item 2 (with asterisk)
\item Item 3
\item Item 4
\item Item 5
\end{enumerate}
\end{document}
答案2
对具有标签默认外观的一级列表进行“简单”修改1.
:
\documentclass{article}
\newcommand{\repitem}{%
\addtocounter{enumi}{-1}%
\let\savedtheenumi\theenumi
\renewcommand{\theenumi}{\arabic{enumi}\itemasterisk}%
\item\let\theenumi\savedtheenumi
}
\protected\def\itemasterisk{\rlap{*}}
\begin{document}
\begin{enumerate}
\item One
\item Two
\repitem Two*
\item Three
\item Four
\repitem Four*
\end{enumerate}
\end{document}
和enumitem
:
\documentclass{article}
\usepackage{enumitem}
\newlist{fancyenumerate}{enumerate}{1}
\setlist[fancyenumerate]{label=\arabic*\perhapsasterisk.}
\protected\def\perhapsasterisk{}
\protected\def\itemasterisk{\rlap{*}}
\newcommand{\repitem}{%
\addtocounter{fancyenumeratei}{-1}%
\let\perhapsasterisk\itemasterisk
\item\def\perhapsasterisk{}%
}
\begin{document}
\begin{fancyenumerate}
\item One
\item Two
\repitem Two*
\item Three
\item Four
\repitem Four*
\end{fancyenumerate}
\end{document}
答案3
一个小型的(可参考的)实现,按照您的要求进行操作:
\documentclass[]{article}
\usepackage{xparse}
\makeatletter
\NewDocumentCommand \myitem { o }
{%
\IfValueTF {#1}
{%
\item[#1]%
}
{%
\addtocounter{enumi}{-1}%
\let\theenumiBAK\theenumi
\def\theenumi{\theenumiBAK\myitem@asterisk}%
\item
\let\theenumi\theenumiBAK
}%
}
\newcommand\myitem@asterisk{}
\protected\def\myitem@asterisk{\textsuperscript{*}}
\makeatletter
\begin{document}
\begin{enumerate}
\item Hihi
\myitem Haha
\item Huhu
\end{enumerate}
\end{document}