2016-12-09 3 views
0

을 "환경 음영이 정의되지 않은"실패 패키지 rticles에서 템플릿 사용하여 PDF 니트하려고 할 때 (출력 : rticles :: acm_article) 나는 다음과 같은 오류 얻을 :Rstudio PDF 니트는 오류

! LaTeX Error: Environment Shaded undefined. 

See the LaTeX manual or LaTeX Companion for explanation. 
Type H <return> for immediate help. 
...            

l.76 \begin{Shaded} 

R 버전 3.3 0.1 (2016년 6월 21일)

플랫폼 : 우분투 16시 10분

나는 내가 texlive-라텍스 기반을 가지고 확인했다

을 실행 x86_64에-PC-리눅스 GNU (64 비트), , texlive-latex 권장 패키지 및 texlive-latex-extra 패키지가 설치되었지만 여전히 운이 없음

here 제안 된대로 중간 .tex 파일에서 pdf를 생성하려고했지만 동일한 오류가 발생합니다.

UPDATE 1 :

내가 this approach을 고려,하지만 작동하지 않았다, 나는 여전히 오류가 발생했습니다 (아마 내 상황에서 작업을 조정할 필요하지만, 확실하지 않은 방법)

업데이트 2 :

해결 방법이 있습니다. chunk 옵션 echo = FALSE를 사용하여 코드를 숨기면 아무런 문제없이 PDF가 생성됩니다.

재현 예 1 : PDF로

title: Short Paper 
author: 
    - name: I Am Me 
    email: [email protected] 
    affiliation: Fictional University 
abstract: | 
    This is the abstract. 

    It consists of two paragraphs. 
bibliography: sigproc.bib 
output: 
    rticles::acm_article: 
    keep_tex: true 
--- 


## Simple test 

Code chuck follows: 

```{r} 
plot(rnorm(10)) 
``` 

니트는 ! LaTeX Error: Environment Shaded undefined.

예 2 실패 : PDF 작업에

--- 
title: Short Paper 
author: 
    - name: I Am Me 
    email: [email protected] 
    affiliation: Fictional University 
abstract: | 
    This is the abstract. 

    It consists of two paragraphs. 
bibliography: sigproc.bib 
output: 
    rticles::acm_article: 
    keep_tex: true 
--- 


## Simple test 

Code chuck follows: 

```{r echo=FALSE} 
plot(rnorm(10)) 
``` 

니트!

두 예제 간의 유일한 차이점은 코드 청크 헤더에 echo=FALSE을 추가하는 것입니다. 출력물에는 코드를 얻지 못하지만, 학술지의 경우에는 어쨌든 필요하지 않습니다. 다른 방법으로 표시 할 수 있다면 필요하지 않습니다.

+0

이 방법을 시도해 보셨습니까? http://stackoverflow.com/questions/34180355/pandoc-syntax-highlighting-in-pdf-not-working. –

+0

여전히 작동하지 않으면 최소한의 예를 제공하십시오. – Christoph

+0

ir는 pandoc 명령을 보내려면 .md 파일이 있어야하기 때문에이 방법을 시도 할 수 없습니다. 제 경우에는 편직 과정이 실패하여 .md 파일이 출력됩니다. – HAVB

답변

1

따라서 여기의 문제는 rticles 템플릿에서 pandoc이 코드 강조 환경을 삽입하는 수단을 생략 할 수 있습니다. Shaded.이 문제를 해결하려면 template.tex 서문에 삽입해야합니다 :

$if(highlighting-macros)$ 
$highlighting-macros$ 
$endif$ 
1

해결 방법이 있습니다. chunk 옵션 echo = FALSE를 사용하여 코드를 숨기면 아무런 문제없이 PDF가 생성됩니다.

재현 예 1 : PDF로

title: Short Paper 
author: 
    - name: I Am Me 
    email: [email protected] 
    affiliation: Fictional University 
abstract: | 
    This is the abstract. 

    It consists of two paragraphs. 
bibliography: sigproc.bib 
output: 
    rticles::acm_article: 
    keep_tex: true 
--- 


## Simple test 

Code chuck follows: 

```{r} 
plot(rnorm(10)) 
``` 

니트는 ! LaTeX Error: Environment Shaded undefined.

예 2 실패 : PDF 작업에

--- 
title: Short Paper 
author: 
    - name: I Am Me 
    email: [email protected] 
    affiliation: Fictional University 
abstract: | 
    This is the abstract. 

    It consists of two paragraphs. 
bibliography: sigproc.bib 
output: 
    rticles::acm_article: 
    keep_tex: true 
--- 


## Simple test 

Code chuck follows: 

```{r echo=FALSE} 
plot(rnorm(10)) 
``` 

니트!

두 예제 간의 유일한 차이점은 코드 청크 헤더에 echo=FALSE을 추가하는 것입니다. 출력물에는 코드를 얻지 못하지만, 학술지의 경우에는 어쨌든 필요하지 않습니다. 다른 방법으로 표시 할 수 있다면 필요하지 않습니다.