I construct a macro named \mymacro, and this macro would be used in two ways:
first: \mymacro, which would typeset 1
second:\mymacro*, which would typeset 2
Here is my code:
\documentclass{article}
\usepackage{ifthen}
\begin{document}
\def\mymacro#1{\ifthenelse{\equal{#1}{*}}{2}{1}}
with star: \mymacro* some text\\ % That is ok.
without star: \mymacro some text % "s" of "some" lost
\end{document}
From the attached typeset you can see that the first charactor s of the word some is lost in the version of without star. Why?
I know \mymacro{} is a solution, but I'd like to know if there is a better way to just use \mymacro only.

\def\mymacro#1{...stuff...}you define a macro that takes on argument. It will always try and absorb an argument. When you use it as\mymacro*the star gets absorbed as argument, but when you say\mymacro some more text,\mymacrograbs the followingsas its argument. The classical way to define starred versions uses\@ifstar, but with new LaTeX you can use the (formerlyxparse)\IfBooleanTFof\NewDocumentCommand'sstype. – moewe Jun 04 '21 at 13:27