1

I've defined a theorem-like environment called ex for exercises for my students. Some of them are taken from other authors and I'd like to give them credit. In order to do that, I was thinking of marking the exercises with $\star$ or $\dag$ superscripts to the exercise number. I've done so through

\documentclass[a4paper]{article}
\usepackage{amsthm}
\newtheorem{ex}{Exercise}[subsection]

\begin{document}

\begin{ex}\textsuperscript{$\star$} Question \end{ex}

\end{document}

However, the superscript appears at a distance of the number itself and looks odd because of the space inserted after the exercise number.

Patricio
  • 339

1 Answers1

2

I would rather define a new theorem style which adds the star automatically. This makes it easier to change it e.g. to a \dag if you decide so. The default definitions for the style plain can be found in the answer to amsthm: what are the newtheoremstyle parameters for the default styles?.

\documentclass{article}

\usepackage{amsthm} \newtheorem{ex}{Exercise}[subsection]

% see https://tex.stackexchange.com/a/17555/82917 \newtheoremstyle{plain} {\topsep} {\topsep} {\itshape} {0pt} {\bfseries} {\textsuperscript{}.}% <-- this is usually just . {5pt plus 1pt minus 1pt} {}
\theoremstyle{plain} \newtheorem{ex}[ex]{Exercise}

\begin{document}

\begin{ex} Question \end{ex}

\begin{ex} Question \end{ex}

\begin{ex} Question \end{ex}

\end{document}

enter image description here

campa
  • 31,130
  • But now it's the period after the asterisk the one that looks odd – Patricio Oct 20 '21 at 12:05
  • @Patricio I agree, but you can exchange them. The seventh argument of \newtheoremstyle controls whatever is put after the number. Write whatever you want there. – campa Oct 20 '21 at 12:12
  • As I have several sources, I've tried repeating this with different names and symbols, but only the last definition is used. – Patricio Oct 20 '21 at 12:57
  • @Patricio \newtheorem always uses the last \theoremstyle. – campa Oct 20 '21 at 13:00
  • Ok. Do you have any suggestion for differentiating exercices by source? – Patricio Oct 20 '21 at 13:13
  • You could set up an internal \newtheorem which uses some helper macro, and the user environments which define this macro to whatever symbol you want. However, this is beyond the scope of this question as it stands. You might want to ask a new question, but please provide all information. – campa Oct 20 '21 at 13:16
  • I just have. In case you care to take a look: https://tex.stackexchange.com/questions/619646/different-superscipts-in-a-list – Patricio Oct 20 '21 at 13:40