5

I would like to remove the section number from only the title, but display it in the figures and equations in the section. My document class is scrartcl and I am using sectsty

I tried

\section*{Problem 1}

but then all my figures and equations become 0.1,0.2... instead of 1.1, 1.2..

How does one go about this?

7
  • 1
    Welcome to TeX.SX! Do you have also normal sections or only problems?
    – egreg
    Commented Sep 28, 2013 at 19:26
  • Glad to be here, just started with TeX! For this document only problems, But I might have to add Theorems later on.
    – Ash
    Commented Sep 28, 2013 at 19:33
  • I mean: are the sectioning commands you use entitled "Problem <number> only?
    – egreg
    Commented Sep 28, 2013 at 19:36
  • Yes, in this case.
    – Ash
    Commented Sep 28, 2013 at 19:45
  • To enrich my knowledge, what would be the simplest way to just remove section numbers from the heading only in an already formatted document without loosing the equation numbering?
    – Ash
    Commented Sep 29, 2013 at 20:05

1 Answer 1

6

You can do this more simply by defining a personal command. This is the simplest way:

\newcommand{\problem}{%
  \refstepcounter{section}%
  \section*{Problem \thesection}}

Here's a skeleton document:

\documentclass{article}

\usepackage{amsmath}

\newcommand{\problem}{%
  \refstepcounter{section}%
  \section*{Problem \thesection}}

\numberwithin{equation}{section}

\begin{document}

\problem\label{easy}

Compute the following expression:
\begin{equation}\label{compute}
1+1
\end{equation}

\problem\label{difficult}

Using the result obtained from~\eqref{compute} in Problem~\ref{easy}, 
express
\begin{equation}
\int_{0}^{x} e^{-t^2}\,dt
\end{equation}
in terms of elementary functions.

\end{document}

enter image description here

There are many possible refinements. For example, you seem to want to have sequences of problems. Here's an attempt at it:

\documentclass{article}

\usepackage{amsmath,xparse}

\NewDocumentCommand{\problem}{ s }
 {%
  \IfBooleanTF{#1}
   {\refstepcounter{subproblem}%
    \section*{Problem \thesubproblem}}%
   {\refstepcounter{section}%
    \section*{Problem \thesection}}%
 }


\newcounter{subproblem}[section]
\renewcommand{\thesubproblem}{\thesection\alph{subproblem}}
\numberwithin{equation}{section}

\begin{document}

\problem\label{easy}

Compute the following expression:
\begin{equation}\label{compute-easy}
1+1
\end{equation}

\problem*\label{less-easy}
Compute the following expression:
\begin{equation}\label{compute-less-easy}
1-1
\end{equation}

\problem\label{difficult}

Using the result obtained in~\eqref{compute-easy} and 
Problem~\ref{less-easy}, express
\begin{equation}
\int_{0}^{x} e^{-t^2}\,dt
\end{equation}
in terms of elementary functions.

\end{document}

A “main problem” is started with \problem, while a “subproblem” is started with \problem*. The equation number will still be the one established by the main problem.

Avoiding the explicit number in the command allows for easily change the order of the problem, by just shuffling around their texts.

enter image description here

2
  • In my current document structure, I have Problem 1, 1a, 1b, 1c. How would I accomplish this?
    – Ash
    Commented Sep 28, 2013 at 20:23
  • @Ash How should an equation in “Problem 1a” be numbered?
    – egreg
    Commented Sep 28, 2013 at 20:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .