Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a comment box using Rmarkdown (HTML file)

Tags:

html

r

r-markdown

I have an issue about creating a comment box (similar to the fbox if we want to output a PDF). The following code works for PDF file but not HTML.

\fbox{\begin{minipage}{48em}
...
\end{minipage}}

Could someone offer me some suggestions how to create a decent comment box for Rmarkdown HTML file? Really appreciate your help.

like image 244
son520804 Avatar asked Dec 13 '22 19:12

son520804


1 Answers

Easiest way is to use predefined bootstrap elements like the following:

<div class="alert alert-info">
  <strong>Info!</strong> Indicates a neutral informative change or action.
</div>

For details check this.

Or you could simply use paragraph tags for the boxes and style them yourself using a CSS class:

---
title: "Comment Box"
output: html_document
---

<style>
p.comment {
background-color: #DBDBDB;
padding: 10px;
border: 1px solid black;
margin-left: 25px;
border-radius: 5px;
font-style: italic;
}

</style>


### Bootstrap Alert

<div class="alert alert-info">
  <strong>Info!</strong> Indicates a neutral informative change or action.
</div>

### Custom Psragraphs

<p class="comment">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</p>

enter image description here

like image 64
Martin Schmelzer Avatar answered Dec 17 '22 23:12

Martin Schmelzer