# How to include formatted list of variable definitions?

#1

I am new to RMarkdown, so maybe I'm missing something. But I've looked for most of this afternoon and still have not found a solution. Hopefully you can help. Here's the problem.

I have a R Notebook to which I am trying to add a list of variable descriptions. Here is a crude set of specifications for the list:

• Entire list is indented by, say, 1/2 inch.

• Variable symbol (name) is the leftmost item. They are left justified and aligned.

• Symbols (names) can be Greek characters, subscripted, or superscripted.

• Total width of the symbols range from one to nine characters.

• Descriptions are indented at least 3 characters to the right of the widest symbol.

• Descriptions are also left-justified and align at the indented horizontal point on the page.

Here is an example of what this might look like (notice I can't left-align the descriptions):

 _A_c_                    Area of a circle [A sub c]
_π_                    Mathematical constant (= 3.14159 ...)
_r^2_                  Value of r squared


g_variable Growth rate of "variable"

Here I've had to use markdown to format the column of variables. Here any internal underscores subscript the following term, and a carat (^) superscripts the following term.

#2

How about using a simple table with no header row, plus (optionally) math syntax for the symbols?

This forum's markdown doesn't do simple tables (as far as I can tell), but here's a pipe table as a partial example (pipe tables require a header row):

Symbol Description
A_c Area of a circle [A sub c]
\pi Mathematical constant (= 3.14159 ...)
r^2 Value of r squared
g_{variable} Growth rate of "variable"

To achieve the overall indent, you could:

1. add an empty column (hard to control width precisely, and sort of a hack)
2. if your output is HTML, wrap the table in <div> tags with some custom CSS applied to increase the left margin
3. if your output is PDF, it may be better to just use a LaTeX table and take care of the indenting in LaTeX

Here's an example of #1:

Symbol Description
A_c Area of a circle [A sub c]
\pi Mathematical constant (= 3.14159 ...)
r^2 Value of r squared
g_{variable} Growth rate of "variable"

And here's the markdown I used:

&nbsp; | Symbol         | Description
-------|----------------|--------------------------------------
&nbsp; | $A_c$          | Area of a circle [A sub c]
&nbsp; | $\pi$          | Mathematical constant (= 3.14159 ...)
&nbsp; | $r$            | Radius of a circle
&nbsp; | $r^2$          | Value of r squared
&nbsp; | $g_{variable}$ | Growth rate of "variable"
---------------------------------------------------------------


ETA: One more option, if your output is HTML: use a raw-HTML description list, which has the benefit of being semantically appropriate to your task. You would need to make sure your CSS formatted it the way you want.