Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question evolved from my earlier question posted here. It turnt out that what I gave as the MWE actually worked, so I investigated a bit and found the real problem. I have a document in which I generally do not want to number the chapters, sections and subsections. Only one section should contain roman numbered subsections. Considering the following code:

\documentclass{report}
\usepackage{titlesec}
\titleformat{\subsection}{\normalsize\bf\it}{}{}{}
\setcounter{secnumdepth}{-1} 
\begin{document} 
\tableofcontents 
\chapter{mwe} 
\section{unnumbered subsections} 
\subsection{unnumbered} 
\section{roman numbered subsections} 
\setcounter{secnumdepth}{2} 
\renewcommand{\thesubsection}{\textnormal{\roman{subsection}}.} 
\subsection{roman one} 
\subsection{roman two} 
\setcounter{secnumdepth}{-1} 
\chapter{Second chapter} 
\section{unnumbered subsections} 
\subsection{unnumbered} 
\end{document}

which is the solution from my earlier post adding the titlesec package and modifying the subsection's title (i.e. lines 2&3). Here I get the 'Missing number treating as zero' error at the line '\subsection{roman one}'. Can anybody tell me why and a fix or work-around?

share|improve this question
    
Could you expand your question a bit please, so that users will be able to tell what's the deal here without having to compile your MWE or to go to that other question? Ideally, you'd also find a title more specific than "problem with X". –  doncherry Nov 1 '11 at 12:16
add comment

1 Answer

up vote 8 down vote accepted

The fourth mandatory argument of \titleformat must not be empty; you can use

\titleformat{\subsection}{\normalsize\bfseries\itshape}{}{0pt}{}

Taking into account a comment, perhaps you're trying to do something like this

\titleformat{\subsection}{\normalsize\bfseries\itshape}{\textnormal{\roman{subsection}.}}{1em}{}
share|improve this answer
    
That was a quick answer, thanks. However, when I change the code accordingly the roman numbering in the document - not in the toc - disappears...any ideas? –  D.Roepo Oct 31 '11 at 16:46
    
Good! @user7091: also note Gonzalo used the better newer font switches. \it overrides the earlier \bf. –  Stefan Kottwitz Oct 31 '11 at 16:47
    
@user7091: see my updated answer. –  Gonzalo Medina Oct 31 '11 at 16:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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