在环境练习中进行逆“更新”练习

在环境练习中进行逆“更新”练习

我在 2010 年左右写了一本书。现在我想添加(更新)一些练习并统计所有更新的练习。但我只能Update 2014。我该如何做Update 0ne 2014,,Update two 2014... 或Update_01_2014,,Update_02_2014...?

\documentclass{book}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\newtheorem{ex}{Exercise}[chapter]
\newenvironment{ex*}
  {\renewcommand\theex{\thechapter.\arabic{ex}\rlap{$^*$}}\ex}
  {\endex}

\newenvironment{New}
  {\renewcommand\theex{\thechapter.\arabic{ex}{$^{\text{(Update 2014)}}$}}\ex}
  {\endex}  
\begin{document}
\chapter{First Chapter}
\section{First section}
\begin{ex}
This is an Exercise
\end{ex}

\begin{ex}
This is an Exercise
\end{ex}
\begin{ex*}
This is a difficult Exercise
\end{ex*}
\begin{New}
This is an update Exercise
\end{New}
\end{document}

在此处输入图片描述

答案1

使用计数器。您可以根据需要调整格式。

\documentclass{book}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\newtheorem{ex}{Exercise}[chapter]
\newenvironment{ex*}
  {\renewcommand\theex{\thechapter.\arabic{ex}\rlap{$^*$}}\ex}
  {\endex}

\newcounter{updatecounter}

\newenvironment{New}
  {\stepcounter{updatecounter}
   \renewcommand\theex{\thechapter.\arabic{ex}{$^{\text{(Update
           \arabic{updatecounter}, 2014)}}$}}\ex}
  {\endex}  
\begin{document}
\chapter{First Chapter}
\section{First section}
\begin{ex}
This is an Exercise
\end{ex}

\begin{ex}
This is an Exercise
\end{ex}
\begin{ex*}
This is a difficult Exercise
\end{ex*}
\begin{New}
This is an updated Exercise
\end{New}
\begin{New}
This is another updated Exercise
\end{New}
\end{document}

在此处输入图片描述

相关内容