Discussion:
strange experience modifying article.cls
2020-04-05 14:52:28 UTC
Consider the following modification of article.cls:

\newcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
% {\normalfont\Large\bfseries}} %PH
{\normalfont\normalsize\itshape}}

This has the side effect of suppressing the numbering, i.e. \section
behave like \section*. Why is that? Actually, I also want to suppress
numbering in the modified .cls, so not only can I live with this but it
will also save me some effort, but I want to understand why the
numbering is suppressed.

At first, I had \textit instead of \itshape. This also suppressed the
numbering, but the indentation of the section titles was (almost?) the
same as if there were numbers. Presumably \itshape is better than
\textit here, so it's not a problem, but, again, I want to undertand
what is going on.

standard: numbered bold sections in large font, numbers flush left
goal: unnumbered unbold sections in normalsize italic font

action: replace \bfseries with \textit
result: numbering is suppressed but indentation is not (section titles
are indented at least very close to what they were with
numbering, as if just the numbers are missing)

action: replace \bfseries with \itshape
result: numbering is suppressed but indentation is not

The last action actually results in what I want, but I want to
understand it. I would expect it to change the size and change bold to
italic but not change the numbering nor the indentation.
Peter Flynn
2020-04-05 20:12:51 UTC
Post by Phillip Helbig (undress to reply)
% {\normalfont\Large\bfseries}} %PH
{\normalfont\normalsize\itshape}}
This has the side effect of suppressing the numbering,
It doesn't do that here. There must be some other change you have made
that is affecting it that you have not told us about.
Post by Phillip Helbig (undress to reply)
They are quite different: \textit is scoped: takes an argument (the text
you want italicised); \itshape is unscoped: it makes everything
following it italicised up to the end of the current group, or the end
of the document.

Peter
2020-04-06 10:32:07 UTC
Post by Peter Flynn
Post by Phillip Helbig (undress to reply)
% {\normalfont\Large\bfseries}} %PH
{\normalfont\normalsize\itshape}}
This has the side effect of suppressing the numbering,
It doesn't do that here. There must be some other change you have made
that is affecting it that you have not told us about.
Definitely not, but probably not worth pursuing as long as I don't have
the latest, greatest LaTeX.
Post by Peter Flynn
Post by Phillip Helbig (undress to reply)
They are quite different: \textit is scoped: takes an argument (the text
you want italicised); \itshape is unscoped: it makes everything
following it italicised up to the end of the current group, or the end
of the document.
Yes, that's why I changed it. However, \textit "worked".
Peter Flynn
2020-04-06 13:45:25 UTC
Post by Phillip Helbig (undress to reply)
Post by Peter Flynn
Post by Phillip Helbig (undress to reply)
% {\normalfont\Large\bfseries}} %PH
{\normalfont\normalsize\itshape}}
This has the side effect of suppressing the numbering,
It doesn't do that here. There must be some other change you have made
that is affecting it that you have not told us about.
Definitely not, but probably not worth pursuing as long as I don't have
the latest, greatest LaTeX.
Shouldn't make any difference: that code is unchanged for decades AFAIK.
Can you try this test.tex:

========================================================================
\documentclass{article}
\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
% {\normalfont\Large\bfseries}} %PH
{\normalfont\normalsize\itshape}}
\begin{document}
\section{Foo}
\end{document}
========================================================================

and let me know which way it comes out? It's possible that if you have a
very old LaTeX, there may be other subtleties elsewhere in article.cls
that are affecting it.
Post by Phillip Helbig (undress to reply)
Yes, that's why I changed it. However, \textit "worked".
It italicised whatever token followed \section. But that isn't reliable,
extensible, or good practice.

Peter