20  Style

Quarto was used to produce this website. here are some examples of what can be done.

20.1 Crossrefs

Crossref chapter (tagged sec- on level 1 heading): Chapter 2

Crossref section (tagged sec- on level 2 heading): Section 2.2.

Crossref Appendix (tagged sec- on level 1 heading): Appendix A

Crossref sub section: Section 2.2.1 Note: Seems to work even though subsection numbers are not shown.

Link: Cider Workshop on Google groups

20.2 Notes on quarto

Did you know you can ignore files by setting a .quartoignore file?

Crossref: Section 17.1

R

https://quarto.org/docs/computations/r.html

  • You can control how data frames are printed by default using the df-print document option
  • Install quarto-mode and Enable poly-quarto-mode in markdown buffer to get ess functionality, code highligting etc

20.3 Org to markdown

In terminal:

pandoc --from=org --to=gfm org-mode-file.org > markdown.md ## Emacs markdown mode

https://github.com/jrblevin/markdown-mode

Table editing

var value category note
a 1 A One
d 4 D Four
b 2 B Two
c 3 C Three
e 5 E Five

TAB : Jump
S-TAB : Jump backwards

C-c arrow : Moves row/column
C-c S-arrow : Edit (add, delete) row/column
-up : Delete row
-down : Add row above
-left : Delete col
-right : Add col left

C-c C-c ^ - Sort rows by pecified column. Prompts for column number and sort method (alphabetical or numerical, optionally in reverse).
C-c C-c | - Convert region to table. Attempts to recognize comma, tab, and space separated data.
C-c C-c t - Transpose table at point.

C-c C-s t (markdown-insert-table)

Test convert: hello, this, is my, attempt, at writing, a, csv

Other useful markdown things

Indentation: https://docs.newrelic.com/docs/style-guide/structure/styleguide-markup-indentation/

Markdown lists

Use four spaces to indent nested list to get automation:

  1. One
    1. a
    2. b
  2. Two

20.4 Heading 2

Text and footnote

  1. Plockning och gallring. Vanligen rekommenderas att man plockar mogen men ej övermogen frukt. Ruttna (illaluktande) frukter gallras bort. Fallskador som är relativt färska är inget problem. Är du osäker kan du skära bort en bit. Smuts sköljs bort. Stjälkarna kan sitta kvar.
  2. Krossning och pressning. Äpplena rives (med äppelkvarn) eller krossas (tex i en hink med hjälp av en stör) till en grov massa. Maler man dem för fint kan det bli en gele som är svår att pressa. Fruktmassan blir snabbt brun men det gör ingenting. Använd en fruktpress för att få fram must. Grovsila därefter musten om det kommit med bitar.
  3. Justering av musten. Mät sockerhalten och tillsätt eventuellt socker så att SG blir 1040 till 1070 (Tumregel: 30g socker per liter ökar SG med 10). Tillsätt eventuellt pektolas (~1 ml till 4L) för att slippa strimmor av pektin i den färdiga cidern. Tillsätt eventuellt äppelsyra1 för att sänka pH om det är >4 (för att motverka skadliga mikroorganismer).

1 Äppelsyra (malat) kan vara krångligt att få tag på. Använder du citronsyra (citrat) riskerar det att bli dålig smak när den malolaktiska jäsningen sker. Vinsyra (tartrat) kan användas, men kan ge kristallutfällning i flaskan (vilket kan förebyggas genom köldstabilisering). Ett alternativ är att landa in äpplen/must med lågt pH.

Quote text here

Arbitrary margin content

20.5 Markdown table

See Tabell 20.1.

fruit price
apple 2.05
pear 1.37
orange 3.09
Tabell 20.1. Fruit prices

Note: This table has “.bordered” property.

20.6 Markdown table in margin

See Tabell 20.2.

fruit price
apple 2.05
pear 1.37
orange 3.09
Tabell 20.2. Fruit prices

Note: This table works but gives warning: “FloatRefTarget elements should not be the only content in a div with column classes. This will not render as expected. Consider moving the floatref targets to their own divs and using the offset attribute.”

A citation[1]

20.7 Knitr table

See Tabell 20.3.

speed dist
4 2
4 10
7 4
7 22
8 16
9 10
Tabell 20.3. Cars

PROBLEM: This table gives error. MWE works, so probably clashes with yaml options. Very curiously, the same error in MWE when citation-location: margin is enabled, but in the book, removing this does not fix the error. However, when adding a citation (!) to the document, the r code for producing a kable table does not give an error. Dont know how to explain this. SOLUTION: 1) include a citation (!) AND 2) disable citation-location: margin

NO HACK: To remove stripes. 1) use html > html-table-processing: none in yaml. AND 2) add to css tr.odd background-color AND 3) use output: asis. DOES NOT WORK (only adds color over the stripes

NOTE: Should probably try to use GT, seems to have a workaround.

20.8 Grid table

How to crossref grid tables? Maybe put in a labeled div.

Sample grid table.{#tbl-gridt}
Fruit Price Advantages
Bananas $1.34
  • built-in wrapper
  • bright color
Oranges $2.10
  • cures scurvy
  • tasty

20.10 Margin Figures

See Figur 20.1.

Figur 20.1. MPG vs horsepower, colored by transmission.

20.11 Image

Se Figur 20.2.

Figur 20.2. Yeast metabolic network

Using symlink to images in root dir.

20.12 Arbitrary Margin Content

You can include anything in the margin by places the class .column-margin on the element. See an example on the right about the first fundamental theorem of calculus.

We know from the first fundamental theorem of calculus that for \(x\) in \([a, b]\):

\[\frac{d}{dx}\left( \int_{a}^{x} f(u)\,du\right)=f(x).\]

20.13 Asides

Asides allow you to place content aside from the content it is placed in. Asides look like footnotes, but do not include the footnote mark (the superscript number).

This is a span that has the class aside which places it in the margin without a footnote number.

20.14 Lists

  • unordered list
    • sub-item 1
    • sub-item 2
      • sub-sub-item 1
  1. ordered list
  2. item 2
    1. sub-item 1
      1. sub-sub-item 1
  1. A list whose numbering

continues after

  1. an interruption
term
definition

20.15 Math

Math: https://qmd4sci.njtierney.com/math

20.16 Base R

Number of lines in plotting area:

[1] 0.78125
[1] 0.78125
[1] 0.1116071
[1] 1.464844