RMarkdown似乎无法在选项卡中生成选项卡

编程入门 行业动态 更新时间:2024-10-27 14:32:37
本文介绍了RMarkdown似乎无法在选项卡中生成选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用RMarkdown创建静态网页.我想定义一个用户界面,该用户界面具有第一层选项卡,然后在第一层下方具有选项卡.我已经在 RMarkdown:Tabbed和Untabbed标题中研究了类似的问题.但是那个答案对我的事业没有帮助.请在我想要实现的标签结构下方找到.

I am trying to make a static webpage using RMarkdown. I want to define a UI which has a first layer of tabs and then tabs underneath the first layer. I've already looked into a similar question at RMarkdown: Tabbed and Untabbed headings . But that answer doesn't help my cause. Please find below the tab structure that I want to acheive.

| Results * Discussion of Results | Quarterly Results * This content pertains to Quarterly Results | By Product * Quarterly Performance by Products | By Region * Quarterly Performance by Region * Final Words about Quarterly Results | Yearly Results * This content pertains to Yearly Results | By Product * Yearly Performance by Products | By Region * Yearly Performance by Region * Final Words about Yearly Results

这是我使用的.Rmd格式的脚本.但是我能够实现的输出看起来像这样当前场景.我希望在区域"选项卡的外部以及在季度结果"和年度结果"中分别添加Final Words about Quarterly Results和Final Words about Yearly Results.

Here is the script in .Rmd format that I was using. But the output I was able to achieve look likes this Current Scenario. I'd want to have Final Words about Quarterly Results and Final Words about Yearly Results outside the Region tab and in Quarterly Results and Yearly Results respectively.

--- output: html_document: theme: paper highlight: tango number_sections: false toc: false toc_float: false --- # Result Discussion {.tabset} We will discuss results here ## Quarterly Results {.tabset} This content pertains to Quarterly Results ### By Product Quarterly perfomance by Products ### By Region Quarterly perfomance by Region Final Words about Quarterly Results ## Yearly Results {.tabset} This content pertains to Yearly Results ### By Product Yearly perfomance by Products ### By Region Yearly perfomance by Region Final Words about Yearly Results

推荐答案

问题来自以下事实:最后一个段落(Final Words about Quarterly Results和Final Words about Yearly Results)属于最后一个级别3部分,而不属于父级别2部分. 您必须手动控制渲染的HTML的切片以获得所需的内容.

The problem comes from the fact that the last paragraphs (Final Words about Quarterly Results and Final Words about Yearly Results) belong to the last level 3 section and not to the parent level 2 section. You have to manually control the sectioning of the rendered HTML to obtain what you want.

使用 pandoc< 2.0 ,唯一的办法是插入原始的HTML:

Using pandoc < 2.0, the only mean is to insert raw HTML:

--- output: html_document: theme: paper highlight: tango number_sections: false toc: false toc_float: false --- # Result Discussion {.tabset} We will discuss results here ## Quarterly Results {.tabset} This content pertains to Quarterly Results <div id="quarterly-product" class="section level3"> ### By Product Quarterly perfomance by Products </div> <div id="quarterly-region" class="section level3"> ### By Region Quarterly perfomance by Region </div> Final Words about Quarterly Results ## Yearly Results {.tabset} This content pertains to Yearly Results <div id="yearly-product" class="section level3"> ### By Product Yearly perfomance by Products </div> <div id="yearly-region" class="section level3"> ### By Region Yearly perfomance by Region </div> Final Words about Yearly Results

如果您使用 pandoc 2.0或更高版本,则可以使用被隔离的divs :

If you use pandoc 2.0 or greater, you can use fenced divs:

--- output: html_document: theme: paper highlight: tango number_sections: false toc: false toc_float: false --- # Result Discussion {.tabset} We will discuss results here ## Quarterly Results {.tabset} This content pertains to Quarterly Results ::: {#quarterly-product .section .level3} ### By Product Quarterly perfomance by Products ::: ::: {#quarterly-region .section .level3} ### By Region Quarterly perfomance by Region ::: Final Words about Quarterly Results ## Yearly Results {.tabset} This content pertains to Yearly Results ::: {#yearly-product .section .level3} ### By Product Yearly perfomance by Products ::: ::: {#yearly-region .section .level3} ### By Region Yearly perfomance by Region ::: Final Words about Yearly Results

更多推荐

RMarkdown似乎无法在选项卡中生成选项卡

本文发布于:2023-10-08 10:02:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1472300.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:选项卡   RMarkdown

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!