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.

I'm trying to write an assigment using an LaTeX template I found. However, I would like to change the template so that the text next to the title whenever the \chapter command is used is "Section" instead of "Chapter" as I don't think the assignment is big enough to name it "Chapters". It would be greatly appreciated if you can help me do that.

If you need my code you can find it below. However, it is quite long. I don't know how to format code in another than indenting by 4 spaces, which is quite tiresome for this amount of code.

%\RequirePackage[l2tabu, orthodox]{nag} % Old habits die hard
\documentclass[10pt,twoside,b5paper,showtrims]{memoir}
%\RequireXeTeX

% Stock and paper layout
\showtrimsoff
\pagebv
\setlrmarginsandblock{26mm}{20mm}{*}
\setulmarginsandblock{35mm}{30mm}{*}
\setheadfoot{8mm}{10mm}
\setlength{\headsep}{7mm}
\setlength{\marginparwidth}{18mm}
\setlength{\marginparsep}{2mm}

\checkandfixthelayout                 % Check if errors!
\sideparmargin{outer}                 % Put sidemargins in outer position (why the fuck is this option not default by the class?)

% Large environments

\usepackage{listings}                 % Source code printer 
% Symbols
\usepackage{amsmath,amssymb, latexsym} % AMS and other symbols


% Graphics and colors
\usepackage{graphicx}                 % Including graphics and using colours
\usepackage{xcolor}                   % Defined more color names
\usepackage{eso-pic}                  % Watermark and other bag
\usepackage{dtucolors}
\graphicspath{{graphics/}}


% Floating objets, captions and references
\usepackage[noabbrev,nameinlink,capitalise]{cleveref} % Clever references. Options: "fig. !1!" --> "!Figure 1!"
\hangcaption
\captionnamefont{\bfseries}
\subcaptionlabelfont{\bfseries}
\newsubfloat{figure}
\newsubfloat{table}
\letcountercounter{figure}{table}     % Consecutive table and figure numbering
%\usepackage{cite}

% Table of contents (TOC)
\setcounter{tocdepth}{1}              % Depth of table of content
\setcounter{secnumdepth}{2}           % Depth of section numbering
\newcommand{\shorttableofcontents}[2]{
  \newcounter{oldtocdepth}\setcounter{oldtocdepth}{\value{tocdepth}} 
  \let\oldcontentsname\contentsname
  \renewcommand*{\contentsname}{#1}
  \setcounter{tocdepth}{#2}
  \tableofcontents
  \setcounter{tocdepth}{\value{oldtocdepth}}
  \renewcommand*{\contentsname}{\oldcontentsname}
}

% Todos
\usepackage{totcount}                 % For total counting of counters
\usepackage[colorinlistoftodos]{todonotes} % Todonotes package for nice todos
                                           % (disable by option [disable])
\newtotcounter{todocounter}           % Creates counter in todo
\let\oldtodo\todo
\newcommand*{\newtodo}[2][]{\stepcounter{todocounter}\oldtodo[#1]{\thesection~(\thetodocounter)~#2}}
\let\todo\newtodo
\let\oldmissingfigure\missingfigure
\newcommand*{\newmissingfigure}[2][]{\stepcounter{todocounter}\oldmissingfigure[#1]{\thesection~(\thetodocounter)~#2}}
\let\missingfigure\newmissingfigure
\makeatletter
\newcommand*{\mylistoftodos}{% Only show list if there are todos
\if@todonotes@disabled
\else
    \ifnum\totvalue{todocounter}>0
        \markboth{\@todonotes@todolistname}{\@todonotes@todolistname}
        \phantomsection\todototoc
        \listoftodos
    \else
    \fi
\fi
}
\makeatother
\newcommand{\lesstodo}[2][]{\todo[color=green!40,#1]{#2}}
\newcommand{\moretodo}[2][]{\todo[color=red!40,#1]{#2}}

% Prefrontmatter
\newcommand{\prefrontmatter}{\pagenumbering{alph}}

% Chapterstyle
\makeatletter
\makechapterstyle{mychapterstyle}{
    \chapterstyle{default}
    \def\format{\normalfont\sffamily}

    \setlength\beforechapskip{0mm}

    \renewcommand*{\chapnamefont}{\format\LARGE}
    \renewcommand*{\chapnumfont}{\format\fontsize{40}{40}\selectfont}
    \renewcommand*{\chaptitlefont}{\format\fontsize{32}{32}\selectfont}

    \renewcommand*{\printchaptername}{\chapnamefont\MakeUppercase{\@chapapp}}
    \patchcommand{\printchaptername}{\begingroup\color{dtugray}}{\endgroup}
    \renewcommand*{\chapternamenum}{\space\space}
    \patchcommand{\printchapternum}{\begingroup\color{dtured}}{\endgroup}
    \renewcommand*{\printchapternonum}{%
        \vphantom{\printchaptername\chapternamenum\chapnumfont 1}
        \afterchapternum
    }

    % egen ændring
    \renewcommand*{\chaptername}{Section}

    \setlength\midchapskip{1ex}

    \renewcommand*{\printchaptertitle}[1]{\raggedleft \chaptitlefont ##1}
    \renewcommand*{\afterchaptertitle}{\vskip0.5\onelineskip \hrule \vskip1.3\onelineskip}

}
\makeatother
\chapterstyle{mychapterstyle}

% Header and footer
\def\hffont{\sffamily\small}
\makepagestyle{myruled}
\makeheadrule{myruled}{\textwidth}{\normalrulethickness}
\makeevenhead{myruled}{\hffont\thepage}{}{\hffont\leftmark}
\makeoddhead{myruled}{\hffont\rightmark}{}{\hffont\thepage}
\makeevenfoot{myruled}{}{}{}
\makeoddfoot{myruled}{}{}{}
\makepsmarks{myruled}{
    \nouppercaseheads
    \createmark{chapter}{both}{shownumber}{}{\space}
    \createmark{section}{right}{shownumber}{}{\space}
    \createplainmark{toc}{both}{\contentsname}
    \createplainmark{lof}{both}{\listfigurename}
    \createplainmark{lot}{both}{\listtablename}
    \createplainmark{bib}{both}{\bibname}
    \createplainmark{index}{both}{\indexname}
    \createplainmark{glossary}{both}{\glossaryname}
}
\pagestyle{myruled}
\copypagestyle{cleared}{myruled}      % When \cleardoublepage, use myruled instead of empty
\makeevenhead{cleared}{\hffont\thepage}{}{} % Remove leftmark on cleared pages

\makeevenfoot{plain}{}{}{}            % No page number on plain even pages (chapter begin)
\makeoddfoot{plain}{}{}{}             % No page number on plain odd pages (chapter begin)

\setlength\parindent{0pt}
share|improve this question
    
Welcome to TeX.SX! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it) or just press <CTRL-K> –  Christian Hupfer Jun 14 at 17:31
    
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}. –  Christian Hupfer Jun 14 at 17:32
2  
Your code is by far too long and contains a lot of unnecessary statements for the question itself and its otherwise incomplete. –  Christian Hupfer Jun 14 at 17:33
1  
You could use \renewcommand{\chaptername}{Section} in the preamble of the document or switch to a class which does not know of chapters. –  Christian Hupfer Jun 14 at 17:34
    
Yes, I am sorry about the length of the code. The thing is that I am struggling to understand it and don't want to remove anything that may be important information. I'll add a MWE :) –  felbo Jun 14 at 17:36

2 Answers 2

up vote 4 down vote accepted
\documentclass[10pt,twoside,b5paper,showtrims]{memoir}
\usepackage[english]{babel}
\addto\captionsenglish{\renewcommand\chaptername{Section}}
\begin{document}
\chapter{Foo}
\section{bar}
baz
\end{document}

enter image description here

share|improve this answer
    
Thank you for this code - it worked perfectly. I don't know why, but the code provided by Christian Hupfer had no effect. This is very likely due to all the initial code used for the template. –  felbo Jun 15 at 0:33
    
I suppose you are using Babel, then everything is set after \begin{document}. The reason why settings from the preamble are overwritten. With \addto\captions... the changes are done by Babel itself. –  Herbert Jun 15 at 6:12
    
Ah, that makes sense! Thanks :) –  felbo Jun 15 at 11:54

Just use \renewcommand{\chaptername}{Section} in the preamble (preferably).

\documentclass{memoir}

\let\LaTeXStandardChapterName\chaptername%
\renewcommand{\chaptername}{Section}

\begin{document}


\chapter{And now I am a section}%


\section{I am a true section, but without "Section" }

\end{document}

enter image description here

share|improve this answer

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.