0

I am trying to define a custom section/paragraph command. In this command I want to reserve some vertical space, and disable the runin of the next paragraph.

When defining a command:

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

I end up with an error regarding a spacefactor. What is the minimum example to achieve this?

! You can't use `\spacefactor' in vertical mode.
\@->\spacefactor 
                 \@m {}
l.518 \stars
Skinkie
  • 65
  • Welcome to TeX SX! Why don't you customise with titlesec instead of re-inventing the wheel? – Bernard Jul 11 '21 at 15:59
  • I want to have different behavior for the invocation of a section with style1 to styleN, but retain the other properties such as being used for the TOC. – Skinkie Jul 11 '21 at 16:06
  • Looking at https://tex.stackexchange.com/questions/58203/changing-the-style-of-a-single-section the example shows that you would change the style of the section by adding a command in front of it. I am looking for command variants that make them explicit, and directly usable, without having to 'reset' them later. – Skinkie Jul 11 '21 at 16:16
  • You can use titleformat and \titlespacing within the document, and further, you can define new levels. Could you be more explicit as to what you're trying to achieve? – Bernard Jul 11 '21 at 16:16

1 Answers1

2

The root cause seemed to be missing makeatletter and makeatother.

\makeatletter
\newcommand\stars{\@startsection {stars}{1}{\z@}%
           {-3.5ex \@plus -1ex \@minus -.2ex}%
           {2.3ex \@plus.2ex}%
           {\normalfont\Large\bfseries}}
\makeatother
Skinkie
  • 65