• Welcome to TeX.SX! Without knowing the definition of `\chapterauthor` it's difficult to say anything sensible. Anyway, the problem seems due to the second big picture. You should make the figures float. – egreg May 23 '17 at 9:09
• Use the `figure` environment – egreg May 23 '17 at 9:14
• (1) never use `\\` in the text, that is not what you want, start a new paragraph (blank line). (2) If you do not what to use the `figure` env that egreg suggests at least put that image into a `center` env, that also gives space around it again reducing the stretch. It wuld be useful to have a full example to work on, not just images of code. (3) In Danish we have many words with hyphens, but LaTeX will not hyphenate these (other than at the hyphen). Assuming you are using dansih babel, consider using `"-` or `"=` instead of the hyphen in these words, then LaTeX is allowed to hyphenate. – daleif May 23 '17 at 9:31