Wandmalfarbe / pandoc-latex-template

A pandoc LaTeX template to convert markdown files to PDF or LaTeX.
BSD 3-Clause "New" or "Revised" License
6.22k stars 968 forks source link

Not able to use custom pdf as page background #166

Closed pfaco closed 4 years ago

pfaco commented 4 years ago

The page background is working just fine using the example pdf's provided. When I try to use a custom PDF it fails with the following error:

Error producing PDF. ! Missing endcsname inserted.

protect l.449 \end{titlepage}

Tried searching here and in pandoc documentation but couldn't find the problem. It seems to happen when generating the pdf using latex.

Any idea what could be wrong on my pdf?

basbebe commented 4 years ago

same here

Wandmalfarbe commented 4 years ago

Please provide the source files and the complete command that you used to render your document.

0xtiago commented 4 years ago

The page background is working just fine using the example pdf's provided. When I try to use a custom PDF it fails with the following error:

Error producing PDF. ! Missing endcsname inserted.

protect l.449 \end{titlepage}

Tried searching here and in pandoc documentation but couldn't find the problem. It seems to happen when generating the pdf using latex.

Any idea what could be wrong on my pdf?

Same here...But My problem was special character in the file name. When I remove it worked like a sharm.

noraj commented 4 years ago

For me it was underscore _ in the filename, I replaced it with dash -.

Wandmalfarbe commented 4 years ago

But My problem was special character in the file name. When I remove it worked like a sharm.

Although the following markdown compiles fine on my machine, it is generally a good idea to avoid special characters in filenames.

## With `-`

![](./image-file.pdf){ width=10cm }

## With `_`

![](./image_file.pdf){ width=10cm }

## With `.`

![](./image.file.pdf){ width=10cm }

## With ` `

![](./image file.pdf){ width=10cm }

## With ` ` (URL encoded)

![](./image%20file.pdf){ width=10cm }

## With `%`

![](./image%25file.pdf){ width=10cm }

## With `{`

![](./image{file.pdf){ width=10cm }

## With `ä`

![](./imäge-file.pdf){ width=10cm }

There was a recent problem with grffile in combination with dots in the filename (see https://github.com/jgm/pandoc/issues/5848 for the full discussion).

The following Markdown would not compile, so I would advise against using extra dots . in filenames.

![This is an image.](./image.file.pdf)
Wandmalfarbe commented 4 years ago

I totally overlooked that you are applying a custom page background. Your issue is a known problem. Please apply the fix mentioned in this issue https://github.com/Wandmalfarbe/pandoc-latex-template/issues/100. You can also replace the underscore in your filename with a hyphen (-).