# Change text from “chapter” to “section” for each new chapter

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}{*}
\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}

\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}
\patchcommand{\printchapternum}{\begingroup\color{dtured}}{\endgroup}
\renewcommand*{\printchapternonum}{%
\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}

\def\hffont{\sffamily\small}
\makepagestyle{myruled}
\makeevenfoot{myruled}{}{}{}
\makeoddfoot{myruled}{}{}{}
\makepsmarks{myruled}{
\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}

-
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 '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 '14 at 17:32
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 '14 at 17:33
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 '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 '14 at 17:36

\documentclass[10pt,twoside,b5paper,showtrims]{memoir}
\usepackage[english]{babel}
\begin{document}
\chapter{Foo}
\section{bar}
baz
\end{document}


-
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 '14 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 '14 at 6:12
Ah, that makes sense! Thanks :) –  felbo Jun 15 '14 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}


-