Using the default Xaringan CSS, if $math$ is placed in a footnote, it appears to be rendered as inline code, rather than rendering as math. I was not able to find information about this - is this just a natural limitation in Xaringan or remark.js? Or perhaps I am doing something wrong?
See basic example below:
# A Test
- This is a test<sup>1</sup>
.footnote[<sup>1</sup> This includes $\delta+\frac{2}{3}$ math.]
This will render the math between the $$ as if it were between backticks.
[UPDATE 17/12/2019] Another way to circumvent this is to replace the maths expression $\delta+\frac{2}{3}$ with \(\delta+\frac{2}{3}\) which bypasses any need for remark.js to convert $ and thus avoiding the bug there.
Yes I noticed this too. I think somehow remark.js is interfering with mathjax but I don't really know. To get around this I use the html code directly instead. So below should work:
# A Test
- This is a test<sup>1</sup>
<span class="footnote"><sup>1</sup> This includes $\delta+\frac{2}{3}$ math.</span>
[UPDATE]
The explanation of why this happens can be found here. TL;DR: remark.js removes the brackets necessary for mathjax to detect the maths.
Yihui also provided an alternate hack if the use of .footnote[] is desirable which involves adding the brackets to the inline math code:
.footnote[<sup>1</sup> This includes `\\(\delta+\frac{2}{3}\\)` math.]
Related
Simple question about comment code aesthetics (color):
I recently noticed in someone's comment code that part of their comment color changed while using the # symbol. After experimenting with it, I noticed you also need to have an apostrophe (') right after the octothorp (#) as such:
#' #text
^--- This turned orange!
Since I'm a detailed commenter, I'd love to step things up if I could by adding color to my comments. I know part of the reason is my global IDE (RStudio) options, but I'd never seen anything change a comment's color before, so I was just curious:
Why does this occur? I've only seen # used when handling large, more-complex objects that need further specification => Ex. LargeObject#data$variable
Are there other symbols that trigger a color change? There's quotes of course (""), but quotes do not change color when they're commented out with an octothorp (#).
Also, on the image (bottom row), is there possibly a way to start and end a comment, followed by a command, all on one line? => Ex. #comment# print(summary(df))
The special highlighting you're seeing — words being highlighted after #' # — is specific to roxygen markup (a documentation-generation system for R). I don't know why that category doesn't seem to be listed/themeable (see #2).
The RStudio syntax highlighting colours are customizable (you can edit these themes visually), but based on what's documented at the link, there appears to be only one category for "comments".
This question has to do with the R parser, not the RStudio highlighting system. So the answer is "no"; everything from the first # on a line to the line break is considered a comment, no exceptions. In principle you could adjust the RStudio highlighting engine to recognize various delimiters within comments and display material following them differently, but you can't create in-line comments (as you could with /* */ in C) without modifying the R parser.
This is my first time using R so this is about as basic of a question as they come.
I am making a presentation using markdown (ioslides). I want to do something very simple which is to put something in superscript. According to the manual, the syntax is the following:
Lower bound = α^Full – K^ - α^Full^
The first time I tried running this, I got a pop-up screen with some options. Too quickly, I pressed enter and inadvertently chose something. Now the syntax won't run and I can't figure out what I did to undo it.
Can someone help? Thank you in advance.
Markdown allows HTML to be used if necessary, so you should be able to use the HTML sup tag.
Right alignment comes handy for letter addresses. Unfortunately, according to the author John MacFarlane:
The pandoc document model does not allow for alignment other than in tables, so the alignment information is simply ignored.
We can resort to raw LaTeX.
Upon trial and error (and googling) I found that this TeX syntax works as intended:
\rightline{Address 1}
\rightline{Address 2}
\rightline{etc}
Also the LaTeX equivalent does:
\begin{flushright}
Address 1\\
Address 2\\
etc
\end{flushright}
The less invasive syntax, based on the LaTeX command raggedleft, unfortunately does not work:
{\raggedleft
Address 1\\
Address 2\\
etc\\
}
This is because braces are passed verbatim (\{, \}) and not as raw LaTeX.
With reference to centre alignment, I found a user claiming that markdown supports this native (beautiful) syntax:
-> This is center align <-
but I didn't find an editor/converter supporting it.
Indeed my working examples are all against the John Gruber markdown philosophy:
A Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions.
Can you find a better way?
Particularly is it possible to simply write a Pandoc template to redefine the alignment of a header, say: ###### Right aligned?
For those that are looking for a similar question here's how to left align/right align on the same line:
**Some bolded text** **\hfill some right aligned on same line bolded text**
You'll have to imagine the result since I'm not sure how to recreate it on SO.
The best way to handle this is to put the address in a YAML metadata block (supported by pandoc 1.12+), and do the alignment in a custom template. Then your source document will be clean, without raw LaTeX, and you can modify templates to get the desired look in any output format.
Source document could look like this:
---
address:
| 23 Main St.
| Somewhere, MT 23434
...
Dear so and so,
Then in your LaTeX template you'd have something like:
\begin{flushright}
$address$
\end{flushright}
If you're writing a letter, though, it would probably be better to write a template using the LaTeX letter class.
As I am using Mathematica a lot I got the idea to write a small and free CAS which just exposes a very small subset of necessary functions and packages to be used and I want to present the results in an appropriate way to the user like Mathematica does (ignore the Facebook logo in the background :D ):
My first idea was to create LaTeX code in the background and to pdflatex the source and include the PDF then in the view... however this seems way to much overkill! I want to write this CAS either in C++ or C# and I want to know if there are any recommended solutions to output nice formula like that.
My first thought was a "real-time formula editing view" but it would be ok to have an input box to enter the commands and formulas and the upper view just to be uneditable output.
A few ways come to my mind.
Use LaTeX behind the scenes to typeset equations, as you say. Again, Cadabra does this.
Use TeXmacs as the front end. Cadabra does this.
Use MathJax. This is a javascript framework which renders TeX equations to images or MathML. It's very easy to use it if you have a HTML view in your UI toolkit. MathJax is used in the sister site MathOverflow, for example.
I find the route 3 is the most attractive.
For calling LaTeX in the background, don't use pdflatex, but use the non-PDF latex to produce a DVI file, and convert it then to PNG with dvipng.
Have a look at the preview package or the standalone class to get the output in the right size (i.e. only the formula, not a whole page).
I am trying to figure out if there is a way to apply the CSS methodology to the LaTeX template I am building. What I would like to do is to have a set of classes that apply a specific style treatment to the bracketed words. For example:
If I have three paragraphs of text, I want to have all of the paragraphs have [0.5cm] of spacing after the last line without having to add \\[0.5cm] after each paragraph.
Is there a LaTeX equivalent of defining the treatment for all paragraphs in the preamble so that it cascades throughout my document? The equivalent of:
<style> p {padding-bottom:0.5cm} </style>
I want to be able to specify multiple version of these CSS-like LaTeX classes throughout my document, so I don't need a specific solution. I need help understanding how to add custom labels/names/classes to the preamble and an example of how to use them in the document itself.
Thanks!
Ryan
It sounds like you want to define your own environment. Below is an example from LaTeX wikibook.
Put this in your preamble:
\newenvironment{king}
{\rule{1ex}{1ex}\hspace{\stretch{1}}}
{\hspace{\stretch{1}}\rule{1ex}{1ex}}
And then use the style in the document:
\begin{king}
My humble subjects \ldots
\end{king}
You could adjust the value of \parskip, see here for explanation.
\addtolength{\parskip}{\baselineskip}
Alternatively, you could just use \setlength:
\setlength{\parskip}{0.5cm}
You could create commands that change the environment (like setting parskip), and issue the commands at different points in the document. Experiment with {bracketing} to change the scope of the changes the command makes.
As far as I know, it isn't possible. :(
The tutorials here may be useful though.