# Add custom logo before chapters with Pandoc

I want to add a custom image near my chapter headings (using the report documentclass). I want to get something like this:

https://tex.stackexchange.com/a/124083/78981

but with the logo above the chapters, and above the Table of Contents (the positioning is a minor detail).

I am using pandoc, which limits me a bit here - as far as I am aware, I can only add latex headers (.tex files to include at the top) and not edit the chapter code directly. I have gotten around this limitation by using \rewnewcommand a lot - for example verbatim block set a shaded color & then write the verbatim block.

The chapter code I want to replace looks like this:

\chapter{Introduction}\label{introduction}


And I tried to renew the chapter command to use the TikZ code from the answer above. Unfortunately that breaks everything. Even a change like this does not build:

\let\oldchapter\chapter
\renewcommand{\chapter}[1]{\oldchapter{Hi #1}}


I get this error, which goes away when I comment the 2 lines out

! 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.1 ...chapter}{\numberline {1}Hi *}{1}{chapter.1}


If I could get this working, I think I could get the logos added. Any suggestions?

Also, I am not tied to the original solution. I tried the solution from https://tex.stackexchange.com/a/12158/78981 but for the table of contents the logo is inline with the title - "Contents".

• Macros like \chapter are one of the candidates for \LetLtxMacro. – Henri Menke Jun 5 '15 at 20:31
• Furthermore you should use existing solutions like the titlesec package or the memoir documentclass for these kinds of modifications. – Henri Menke Jun 5 '15 at 20:32
• You should make your \chapter and related modifications in a personal .sty file and then load that file in some template file (the default one is called something like default.latex; see more here) for the conversion. I don't really understand what you have been doing, but it sounds wrong to me. – jon Jun 5 '15 at 21:20