1

I'm writing a collection of short stories. It works fine with Texmaker, but the chapters comes on top of the title of each story. The start page of a story starts with chapter no and then the name of the short story.

Chapter 1
Hushjelpen

Here is the tex document:

\documentclass[oneside]{book}
\usepackage[utf8]{inputenc}
\usepackage[norsk]{babel}
\usepackage{parskip}
\begin{document}
\tableofcontents
\input{tex/hushjelpen}
\input{tex/buret}
\input{tex/stolen}
\end{document}

I'm starting each new story with:

\chapter

I'm writing in norwegian so maybe the best is to get rid of then chapter/story no.

Anybody any thoughts about this problem?

Dag R

  • Welcome to TeX.SX! Please post a small compilable example. I am pretty sure we had such questions (and answers too) to achieve this – user31729 Jul 3 '16 at 13:12
  • This sounds like it would be very easy to help you with. However, as the solutions will depend on other things in your main .tex file, no one can help until you post an example for others to see. We require a minimal example (or see here) in order to help. – jon Jul 3 '16 at 21:17
  • It depends on the document class. There may be an oddball class which does precisely what you want. Or you can use a standard class and change the headers, etc. – John Kormylo Jul 4 '16 at 3:07
  • I have edited the question so it should be easier for you to give me an answer. As @JohnKormylo said. The real question for me are to edit the headers in a standard class or find a oddball class which do exactly what I want. I go with the first alternative. How do I change the headers of {book}? – Dag Ringdal Jul 9 '16 at 18:48
0

The macro \story combines the table of contents from \chapter and the title from \chapter*. I also eliminated the "short title" option for simplicity. The float stuff is probably unnecessary.

I eliminated all the Nowegian stuff since it should have no bearing and I can't test it anyway.

\documentclass[oneside]{book}
\usepackage{lipsum}

\makeatletter
\newcommand{\story}[1]% #1 = lname of story
 {\cleardoublepage
  \thispagestyle{plain}
  \global\@topnum=0% no floats here
  \ifnum \c@secnumdepth >\m@ne
    \if@mainmatter
      \refstepcounter{chapter}%
      \typeout{\@chapapp\space\thechapter.}%
      \addcontentsline{toc}{chapter}%
        {\protect\numberline{\thechapter}#1}%
    \else
      \addcontentsline{toc}{chapter}{#1}%
    \fi
  \else
    \addcontentsline{toc}{chapter}{#1}%
  \fi
  \markboth{\MakeUppercase #1}{\MakeUppercase #1}%
  \addtocontents{lof}{\protect\addvspace{10\p@}}%
  \addtocontents{lot}{\protect\addvspace{10\p@}}%
  \if@twocolumn
    \@topnewpage[\@makeschapterhead{#1}]%
  \else
    \@makeschapterhead{#1}%
    \@afterheading
  \fi}
\makeatother

\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\story{My First Story}
\lipsum[1-8]
\story{My Second Story}
\lipsum[1-8]
\end{document}
  • This sounds very interesting. Do I paste in this code in the master document? Or is this macro a part of a standard packet i Latex? – Dag Ringdal Jul 10 '16 at 11:58
  • I created this macro by copying parts of the \chapter definition from book.cls. BTW, one can easily lose the chapter number in the table of contents. A search for \story found no hits, but there is a plain tex file named story.tex. – John Kormylo Jul 10 '16 at 15:56
  • It worked nice. I did som small adjustments, and now it works as hoped. Thanks a lot. – Dag Ringdal Jul 10 '16 at 16:34
  • You could hit the check mark are remove this from the list of unanswered questions. – John Kormylo Jul 10 '16 at 16:43

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.