4

I have been trying to get a particular format for section headings in Texlipse using the following code.

\usepackage{titlesec}
\titleformat{\section}[block]{\bfseries\filcenter}
{\S\thesection}{1em}{}
\renewcommand\thesection{\arabic{section}}

But I don't get the output in the required format. Moreover, I get a warning message

No argument following \section 

Any clues?.

3
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Apr 14 '14 at 19:52
  • Also, what is the required output? – Torbjørn T. Apr 14 '14 at 20:02
  • 1
    I imagine the "warning message" is specific to Texlipse, and not something you get from TeX during compile. Correct? – Werner Apr 14 '14 at 20:06
2

I believe this is a problem due to TeXlipse trying to be smart, but it doesn't distinguishing when \section is used in a macro definition in the preamble or in the document environment.

You might be able to trick TeXlipse into not “seeing” the \section command by saying

\usepackage{titlesec}
\expandafter\titleformat\expandafter{\csname section\endcsname}[block]
  {\bfseries\filcenter}
  {\S\thesection}
  {1em}
  {}
\renewcommand\thesection{\arabic{section}}

Or just ignore the spurious warning.

About the output not being what you want, you should tell what output you're expecting.

1
  • Thank you very much for the help. It worked. I was expecting the section name in the center, in bold format, with the arabic symbol for section preceding it. Before using the format you suggested, I was getting just the section name with no alignment or bold-ed. – user49908 Apr 15 '14 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.