0

I am typesetting a problem-answer style math book. I have not decided on the final "look" (styles with respect to headers, etc.). Right now, one of my main concerns is to be as flexible as possible, so that the final look can be styled just by fiddling with initial settings with respect to whatever. (Rather than going over the whole work and manually changing one by one.)

Mainly I have chapters and in each chapter "Problem #N", followed by "Solution #N". I do not know whether it was the correct decision or not, but initially I decided on:

\newtheoremstyle{problemstyle}  % <name>
        {12pt}                  % <space above>
        {12pt}                  % <space below>
        {\normalfont}           % <body font>
        {}                      % <indent amount}
        {\bfseries}             % <theorem head font>
        {\normalfont\bfseries:} % <punctuation after theorem head>
        {.5em}                  % <space after theorem head>
        {}                      % <theorem head spec>
\theoremstyle{problemstyle}

\newtheorem{problem}{Problem}[chapter] % Comment out [section] to remove section number dependence

\newtheoremstyle{solutionstyle} % <name>
        {12pt}                  % <space above>
        {12pt}                  % <space below>
        {\normalfont}           % <body font>
        {}                      % <indent amount}
        {\bfseries}             % <theorem head font>
        {\normalfont\bfseries:} % <punctuation after theorem head>
        {.5em}                  % <space after theorem head>
        {}                      % <theorem head spec"normal")>
\theoremstyle{solutionstyle}

\newtheorem{solution}{Solution}[chapter] % Comment out [section] to remove section number dependence

And I typed the each problem within \begin{problem} .. \end{problem}(Same approach for solutions.)

Question

Putting aside what I already have done, and with respect to being flexible and future-proof with my design-related decisions/mind-changes:

1) Should I enclose the problems (solutions) in some custom environment? (Or should I simply begin a new section for each problem and a new section for each solution. (And, perhaps, do the styling with titlesec-like package?))

2) If yes, what is a good way to define an environment such that it will automatically insert, say, Problem #N (which, say will be numbered by chapter number followed by problem number within the chapter), where I can style the Problem #N without any limitations? (For example, should the environment automatically start some section (or subsection)?)

6
  • 1
    I think your decision is correct so far. As far as I can see you have defined two custom environments. That's really future-proof and flexible as you can redefine them whenever you need to (without needing to stick to theorems). I would definitely not do this section idea.
    – TeXnician
    Commented Aug 9, 2017 at 8:58
  • @TeXnician For now, my worry is that theoremstyle approach is limited with respect to label styling (including line-break after the label).
    – blackened
    Commented Aug 9, 2017 at 9:36
  • What do you mean with label? \label or something like the environment's title? However, if you do not need theorem, you can easily define the environment in another way without changing the rest of the document. That's what I meant with very flexible.
    – TeXnician
    Commented Aug 9, 2017 at 9:40
  • @TeXnician Edited my second question with respect to your comment.
    – blackened
    Commented Aug 9, 2017 at 10:28
  • You want to use counters. There are tons of tutorials out there that explain the concept of counters. And again I would not advise you to start a section with every occurrence of the environment.
    – TeXnician
    Commented Aug 9, 2017 at 10:31

1 Answer 1

2

I think your concept is pretty flexible and future-proof. You have to separate environments and can change them to your liking without changing the rest of the document. So there won't be many problems with that. It is even up to you to not use theorems anymore at any point.

Here's a minimal adapted version for one of the environments. You can change the whole titling etc. fully to your liking. But probably you should read some introductory material on (La)TeX constructions like counters etc. first.

\documentclass{report}

\newcounter{problem}[chapter]
\newenvironment{problem}{
  \refstepcounter{problem}
  \noindent\textbf{Problem \thechapter.\theproblem}\vskip1em
}{\vskip2\baselineskip}

\begin{document}
\chapter{Test}
\begin{problem}
Some problem
\end{problem}
\begin{problem}
Some other problem
\end{problem}
\chapter{Test}
\begin{problem}
Some problem
\end{problem}
\end{document}

You must log in to answer this question.

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