我有一个 qmd 四开文件,具有不同的输出格式:html 和 pdf。
我的目标是根据输出格式生成图形。
如何在 R 单元中检测处理输出格式是 html 还是 pdf?一个简单的 if 语句就足够了。
---
title: My title
format:
html:
toc: true
toc-depth: 3
html-math-method: katex
pdf:
keep-tex: true
toc: true
number-sections: true
colorlinks: true
---
Run Code Online (Sandbox Code Playgroud)