I am attempting to redefine the chapter command to remove the vertical space that appears above the chapter style when placed at the top of the page, while still keeping it in position (that is not making it overlap other text) if used in the middle of a page. I found that vspace only adds space when used in the middle of a page while vspace* adds space all the time I did something like this:
\documentclass[oneside,12pt]{report}
\usepackage{amsmath}
\RequirePackage[style=ieee, backend=biber, citestyle=ieee, natbib=true]{biblatex}
\makeatletter
\let\oldchapter\chapter
\renewcommand*\chapter{
\@ifstar{\starchapter}{\@dblarg\nostarchapter}
}
\makeatother
\def \extrachpspc{15pt}
\newcommand*\starchapter[1]{
\vspace{\extrachpspc}\vspace*{-\extrachpspc}\oldchapter*{#1}
}
\def\nostarchapter[#1]#2{
\vspace{\extrachpspc}\vspace*{-\extrachpspc}\oldchapter[{#1}]{#2}
}
\addbibresource{references.bib}
\begin{document}
\tableofcontents{}
\end{document}
Where space is added before chapter in the middle of the page while also removed when rendered at the top of the page. Leaving chapter rendering without a top margin.
This used to work fine, but I'm guessing I updated some package somewhere (probably a while back because I can't remember) because now I get the following error:
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.3 \contentsline {chapter}{\numberline {1}*}{2}
So my questions are:
- What does the error mean?
- Is there some conflict with
amsmath
? Because if I remove the this simple example renders but I need that package later on. - Is there another way of achieving what I want?
- And finally what is wrong with my approach?
%
but also the intention is rather hard to understand.\chapter
in the report class starts a new page so what do you mean by the distinction between being at top or middle of a page?