HOWTO · R

R을 사용하는 정의되지 않은 제어 시퀀스 Latex

이 튜토리얼은 R에서 정의되지 않은 제어 시퀀스 라텍스 오류를 보여줍니다.

이 페이지의 내용

이 튜토리얼은 R의 undefined control sequence latex 오류를 보여줍니다.

R을 사용하는 정의되지 않은 제어 시퀀스 Latex

Latex를 R과 함께 사용할 때 Latex 구문에 구문 오류나 오타가 있으면 정의되지 않은 제어 시퀀스 latex 오류가 발생합니다.

일반적으로 Latex 사이에 R 코드를 삽입해야 할 때가 있으며 해당 파일은 Rtex 확장자로 저장됩니다.

이 오류의 일반적인 원인은 오타입니다. 예를 들어 그리스 문자 $\alpha$를 작성할 때 $\slpha$와 같이 입력 실수를 하면 정의되지 않은 제어 시퀀스 라텍스 오류가 발생합니다. 예를 들어 보겠습니다.

\documentclass{article}
\begin{document}

Let's use R commands in our \LaTeX{} document which will be processed and output will be included in the document:

\begin{equation}
\slpha
\end{equation}

<<>>=
# Use R to create a sequence of numbers
a = 1:100

# Use R to display basic statistical measures
summary(a)

@
\end{document}

위의 코드를 실행하면 Latex 화면에 \alpha 없이 출력이 표시되고 로그에 정의되지 않은 제어 시퀀스 오류도 표시됩니다. 출력 참조:

라텍스 문서:

정의되지 않은 컨트롤 시퀀스

로그 파일:

정의되지 않은 컨트롤 시퀀스 오류

이 오류를 해결하려면 Latex 구문을 올바르게 작성하고 오타 실수가 없는지 확인해야 합니다. 이것은 Latex에서 R을 사용하거나 R에서 Latex를 사용하는 경우에 적용됩니다.

솔루션을 살펴보겠습니다.

\documentclass{article}
\begin{document}

Let's use R commands in our \LaTeX{} document which will be processed and output will be included in the document:

\begin{equation}
\alpha
\end{equation}

<<>>=
# Use R to create a sequence of numbers
a = 1:100

# Use R to display basic statistical measures
summary(a)

@
\end{document}

유일한 입력 오류가 수정되면 정의되지 않은 제어 시퀀스 latex가 해결됩니다. 출력 참조:

정의되지 않은 제어 시퀀스 솔루션