Git Product home page Git Product logo

problemrenderpdf's Introduction

ProblemRenderPDF

Problem

When creating a RMarkdown document with the following, standard yaml everything works out well and a pdf is produced.

---
title: "Failed Test"
output:
  pdf_document: default
  html_document: default
---

This is going to work

If the text contains just one markdown markup like # for making a title:

---
title: "Failed Test"
output:
  pdf_document: default
  html_document: default
---

# This is not going to work

the following error message is given without further compilation.

knitr::include_graphics(here('pics', 'Fehlermeldung.png'))

The error message may vary a bit but is often of the type !undefined control sequence.

The log file looks like

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex 2020.12.10)  15 DEC 2020 18:42
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**NB_one.tex
(./NB_one.tex
LaTeX2e <2020-10-01> patch level 2
L3 programming layer <2020-12-07> xparse <2020-03-03> (/Users/Martin/Library/Ti
nyTeX/texmf-dist/tex/latex/base/minimal.cls
Document Class: minimal 2001/05/25 Standard LaTeX minimal class
)
(/Users/Martin/Library/TinyTeX/texmf-dist/tex/latex/l3backend/l3backend-pdftex.
def
File: l3backend-pdftex.def 2020-09-24 L3 backend support: PDF output (pdfTeX)
\l__kernel_color_stack_int=\count177
\l__pdf_internal_box=\box47
)
No file NB_one.aux.
\openout1 = `NB_one.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
! Undefined control sequence.
l.4 \hypertarget
                {this-is-not-going-to-work}{% 
Here is how much of TeX's memory you used:
 192 strings out of 481331
 5031 string characters out of 5917010
 264796 words of memory out of 5000000
 17145 multiletter control sequences out of 15000+600000
 403430 words of font info for 27 fonts, out of 8000000 for 9000
 14 hyphenation exceptions out of 8191
 38i,0n,46p,127b,38s stack positions out of 5000i,500n,10000p,200000b,80000s

!  ==> Fatal error occurred, no output PDF file produced!

I have done all proposed changes I could find:

  • reinstall tinytex with all the miracles of tinytex::install_tinytex() and closing and opening RStudio
  • deleted MacTex with Latexit and TexShop
  • re-installed it again
    • updated ALL latex-packages
  • I have made a tex.file with adding keep_tex=true out of the Rmd.file and tried to compile this in TexShop.
  • I have made the same with with an md.file and tried to compile via pandoc with pandoc text.md -s -o text.pdf without any succes. It led to the same error message as from RStudio.
  • I upgraded pandoc from something like 2.5 to now 2.11.2 without any success.
  • After recognizing that the upgrade of pandoc initially did not lead the system to find the right version, I found out that there was a Haskell pandoc version, which I deleted. The new version could then be found via terminal pandoc --version and in RStudio with rmarkdown::pandoc_version().
  • I followed all the recommendations Yihui gave
  • I posted a question in RCommunity without any reply
  • All relevant R-packages were updated

At latest here I was thinking about the pandoc-template as a possible source of the problem. And I found this talk.macpoweruser

and this StackExchange

I downloaded this new template , stored in the directory where .Rmd was with the name mytemp.tex and changed my yaml to:

---
output: 
  pdf_document:
    template: mytemp.tex
  html_document:
    df_print: paged
---

That worked!

Helpful Links

problemrenderpdf's People

Contributors

marblo avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.