- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想打印一个启用了 .tabset 的页面。
例如:
# **Tables** {.tabset .tabset-fade .tabset-pills}
## Table 1
a table here
## Table 2
another table here
@media print {
.tabs {
display: block;
}
}
最佳答案
尝试以下 CSS:
<style>
@media print {
.tab-pane {
display: block !important;
opacity: 1;
}
}
</style>
<style>
@media print {
.tab-pane {
display: block !important;
opacity: 1;
}
/* do not show tabset navigation */
ul.nav {
display: none !important;
}
/* show headers when printing */
.printhead {
display: block !important;
opacity 1 !important;
}
}
/* dont show the headers on screens */
@media screen {
.printhead {
display: none;
opacity: 0;
}
}
</style>
<script>
$(document).ready(function() {
var $tabsets = $("div.tabset"); // get all tabsets
$tabsets.each(function() { // for each tabset...
var tabNames = $(this).find("ul.nav-pills > li") // get all the tab-pane titles...
.map(function() {
return $.trim($(this).text());
}).get();
$(this).find(".tab-content > .tab-pane").each(function(key, value) { // and for each tab-pane, prepend the corresponding title
$(this).prepend("<h2 class=\"printhead\">" + tabNames[key] + "</h2>");
});
});
});
</script>
---
title: "Untitled"
output:
html_document: default
---
<style>
@media print {
.tab-pane {
display: block !important;
opacity: 1;
}
ul.nav {
display: none !important;
}
.printhead {
display: block !important;
opacity 1 !important;
}
}
@media screen {
.printhead {
display: none;
opacity: 0;
}
}
</style>
<script>
$(document).ready(function() {
var $tabsets = $("div.tabset");
$tabsets.each(function() {
var tabNames = $(this).find("ul.nav-pills > li")
.map(function() {
return $.trim($(this).text());
}).get();
$(this).find(".tab-content > .tab-pane").each(function(key, value) {
$(this).prepend("<h2 class=\"printhead\">" + tabNames[key] + "</h2>");
});
});
});
</script>
# **Tables** {.tabset .tabset-fade .tabset-pills}
## Table 1
a table here
## Table 2
another table here
关于r-markdown - 如何打印出由 rmarkdown 生成的页面的所有选项卡?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53654741/
我正在尝试使用此示例将 3 个文件编织在一起:http://rmarkdown.rstudio.com/rmarkdown_websites.html 我的文件都共享同一个目录,该目录已在 RStud
我正在将 Rmarkdown 与 python 一起使用。相当于R python的内联代码? 例如,在 https://rmarkdown.rstudio.com/lesson-4.html我可以 `
我正在用 Rmarkdown 编写一系列相互补充的报告。我想将上一份报告的结果包含在我目前正在处理的报告中。我看到其他问题建议使用 purl 从 Rmarkdown 文档中提取 R 代码然后运行它,所
我想演示如何编写 RMarkdown,其中所说的 RMarkdown 演示嵌入在用于创建类(class) Material 的 RMarkdown 文档中。在这个围栏代码块中,我不希望 knitr 执
我在 Amazon AWS EC-2(Amazon Linux AMI 2015.09.1 (HVM),SSD Volume Type - ami-60b6c60a)上安装了一个 Shiny 的服务器
我刚刚开始使用 rmarkdown、pandoc 和 knitr。我在尝试让 pandoc 获取比 rmarkdown 文档高一级的图像时遇到了很多困难。例如,考虑我们的项目目录是 ~/test,下面
我希望将 Bootstrap 导航栏(如此处所示:https://getbootstrap.com/docs/4.0/components/navbar/)添加到我正在创建的 R Markdown 模
我正在尝试通过 Rmarkdown 并排打印两个表格,输出为 PDF。 我可以很好地打印这些表格,但它们最终靠得很近,我找不到在它们之间创造更多空间的方法。我在其他帖子中找到的解决方案返回奇怪的输出或
我报告了一个问题 https://github.com/rstudio/rmarkdown/issues/967我想知道是否有解决方法(如何使其工作)? 下面的可重现示例(改变 n 和 nGroup
我正在将 Rmarkdown PDF 文档与以下 YAML 设置放在一起: --- output: pdf_document: fig_caption: true fig_crop
我有类似于以下的代码,它是动态生成并存储在变量中的: --- title: "test" author: "me" date: "3 June 2019" output: html_document
我经常编写可供技术人员和高管阅读的 Markdown 文档。 从这个意义上说,我想知道是否可以在 HTML 中创建一个按钮来隐藏或显示最终输出中的代码块? 目前,我正在创建两个单独的文件,我认为这是一
我正在使用 rmarkdown 在 RStudio 中进行投影仪演示。我想在演示文稿的顶部获得幻灯片代码。德累斯顿主题应该支持那些股票 Dresden 那么是否有可能通过使用 rmarkdown 来获
我有一个简单的问题。我如何使用 Rmarkdown/knitr 创建词汇表。我与 RStudio 合作。 我尝试这个但没有成功 \usepackage{glossaries} 在 header.tex
我有R包,它的功能之一-产生报告。在inst/markdown中,我有一个模板rep.rmd。在包函数ProduceReport()中,我有以下代码: render.file <-"rep.Rmd
嗨,我想在我的 Rmarkdown 文件的一侧添加一个页面导航。如果它看起来像侧边栏就好了 on this page . --- title: "My Title" author: "My Name"
当我为学生准备教程时,我需要一种方法来隐藏可折叠面板中的内容,这些面板可以通过单击按钮来显示。我已经使用下面的代码让它工作了。 RMarkdown 文件如下所示: --- title: Collaps
我最近开始使用 r-markdown使用来自 rticles 的便捷模板准备期刊文章.但是,我们最终使用 Word 而不是 LaTex 提交。合作者更喜欢 Word,目前,并非所有期刊都接受 LaTe
我有两个 RMarkdown 文件。 main.Rmd这是渲染的主文件 example.Rmd它包含更长的示例并在其他地方使用(因此它存在于自己的文档中)。 我想包括example.Rmd在 main
在我的 R 文件中,我有: library(rmarkdown) rmarkdown::render("C://Users//me//Desktop//test_param.Rmd",
我是一名优秀的程序员,十分优秀!