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}. Commented Apr 14, 2014 at 19:52
  • Also, what is the required output? Commented Apr 14, 2014 at 20:02
  • 1
    I imagine the "warning message" is specific to Texlipse, and not something you get from TeX during compile. Correct? Commented Apr 14, 2014 at 20:06

1 Answer 1

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. Commented Apr 15, 2014 at 0:30

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.