https://github.com/rstudio/cheatsheets/raw/master/rmarkdown-2.0.pdf
The cheat sheet above lists the following syntax to generate a bulleted list in R Markdown. * is the primary solid bullet. + is a secondary hollow bullet. And - is a tertiary solid square.
* unordered list
+ sub-item 1
+ sub-item 2
- sub-sub-item 1
After I render the output with knitr I don't get the expected output. I get what's shown below. The second and third lines are not indented. Only the very last line is indented, and only one indent instead of the expected two. And all bullets are the secondary hollow style. It's as if I put the following syntax into R Studio, but I didn't.
+ unordered list
+ sub-item 1
+ sub-item 2
+ sub-sub-item 1
How do I get what I intended, the first chunk of pasted syntax?
For each sub-level instead of one tab, include two:
* unordered list
+ sub-item 1
+ sub-item 2
- sub-sub-item 1
Output:
See the Pandoc documentation under Block content in list items.
Was looking for the same, you may do also something like
<body>
<h3>Today's shopping list:</h3>
<ul>
<li>Milk</li>
<li>Eggs</li>
<li>Cereal</li>
<li>Fruit</li>
</ul>
</body>
This link may help too as well.
Related
would there be an effective way to directly remove commas from the yielded results via getall()?
As an example, the data I'm trying to retrieve is in this format:
<div>
Text 1
<br>
Text 2
<br>
Text 3
</div>
My current selector for this is:
response.xpath("//div//text()").getall()
Which does get the correct data but they come out as:
Text 1,
Text 2,
Text 3
instead of
Text 1
Text 2
Text 3
I understand that they get recognized as a list which is the reason for the commas but would there be a direct function to remove them without affecting the commas from the text itself?
I'm just going to leave the solution I used in case someone needs it:
tc = response.xpath("//div//text()").getall() #xpath selector
tcl = "".join(tc) #used to convert the list into a string
I am creating a html report using R Markdown. The first paragraph contains a list of categories represented by certain samples with short descriptions. Here is an example:
This is the test list:
* **first group**:
+ **item 1** - this is the description of an item
* **second group**:
+ **item 2** - this is the description of an item
+ **item 3** - this is the description of an item
* **third group**:
+ **item 4** - this is the description of an item
* **fourth group**:
+ **item 5** - this is the description of an item
+ **item 6** - this is the description of an item
The text was inserted outside the code chunks. I would like to preserve this (even) spacing between the lines in knitted document, so it would be easy readable. Otherwise it looks too squished. Unfortunately R Markdown changes spacing, so some of them are uneven. I tried using trailing spaces and defining line breaks with br, but nothing changed. I could off course edit the html file manually after knitting, but this is a brute force way. R Markdown has to have some option to deal with it - but I was not able to figure it out myself. Would appreciate any help.
You could add a css tag at the start of your rmarkdown document to specify how you would like the html output to interpret line heights:
```{css}
li {
line-height: 3;
}
...
I want to write an equation in Jupyter notebook's markdown cell which contains text with space. I tried writing the following.
\begin{equation*}
e^{i\pi} + 1 + some text = 0
\end{equation*}
Which results like this.
How to add space between "some" and "text"? Thank you.
You can try wrapping your text in \text{}.
\begin{equation}
e^{i\pi} + 1 + \text{some text} = 0
\end{equation}
Note: this is more of a latex question, to which you can get answers from here.
In addition, you could consider " \ " and "\quad" directives to add horizontal space between elements in a LaTeX environment, also "\hskip".
I'm trying to create a nested numbered list within a Jupyter Notebook Markdown cell for use as a table of contents which links to titles in the document. However the items in the list which should be nested/indented just appear on the same line when the cell has been executed.
I have tried using four spaces before the numbers I want indenting (which is what I've seen people suggesting). This didn't work so I also tried 1-3 spaces and using a tab but none seem to work. Thought it may be an issue with the numbering itself and the use of fullstops (i.e. "1." and "1.1" , and not "1.1." etc), but this doesn't fix the issue either.
The indent does work if i use an asterisk in place of 1.1, 1.2 etc., but this is not the format I want.
Markdown code example:
1. [Intro](#intro)
1.1 [Part A](#pA)
1.2 [Part B](#pB)
1.3 [Part C](#pC)
2. [Main](#main)
This code outputs:
1. Intro 1.1 Part A 1.2 Part B 1.3 Part C
2. Main
Desired output:
1. Intro
1.1 Part A
1.2 Part B
1.3 Part C
2. Main
You need to add one of the following:
two white spaces at the end of each line, or
a <br> tag at the end of each line.
for instance:
1. [Intro](#intro)<br>
1.1 [Part A](#pA)<br>
1.2 [Part B](#pB)<br>
1.3 [Part C](#pC)<br>
2. [Main](#main)<br>
Results:
To create a numbered list, enter 1. followed by a space, for example:
1. Numbered item
1. Numbered item
For simplicity, you use 1. before each entry. The list will be numbered correctly when you run the cell.)
To create a substep, press Tab before entering the numbered item, for example:
1. Numbered item
1. Substep
Source (scroll down to "Numbered lists"): https://www.ibm.com/docs/en/watson-studio-local/1.2.3?topic=notebooks-markdown-jupyter-cheatsheet
I want to make an indented list, but I don't want it to have bullet points or numbers. I am using Rmarkdown in RStudio, and knitting to html.
#### bla bla bla
* Example indented line with bullet point
* Another indent with another bullet point
* Yea this is good except for the stupid bullets!
1. Example indented line with numbers
* sure and an indent with a bullet too
2. But there's these stupid numbers now!
two spaces doesn't indent at all
or nest indent with 4
yea still no indent with 2.
four spaces ALSO doesn't indent
just makes some stupid code
why do you hate indents rmd??
This can be achieved using Line Blocks which are built-in to the R Markdown syntax. If you want the indentation to be respected, you can start a line with |.
This approach works across multiple output formats and doesn't require any additional CSS styling:
---
output:
html_document: default
pdf_document: default
---
Here is some text with no indentation
| A list
| A sublist
| Sublist Item 2
| Sublist Item 3
If you want to change how a list looks and you're outputting to HTML, use css:
---
title: "ListTest"
output: html_document
---
<style>
.nobullet li {
list-style-type: none;
}
</style>
<div class="nobullet">
* This list
* Doesn't have bullets
</div>
* This list
* Is normal
This won't work for other output formats.