Mathjax does not render colorbox correctly - latex

I try to render \colorbox{yellow}{\sigma} and configurate the mathjax following http://docs.mathjax.org/en/latest/tex.html), but it just does not work.
Result:
Configuration I find from http://docs.mathjax.org/en/latest/tex.html (I tried with and without autoload-all.js, both don't work):

It looks like the same issue here on https://tex.stackexchange.com/
The problem here is that \colorbox reverts its argument back to text mode
Then you should write:
\colorbox{yellow}{$\sigma$}
Convenient sites to test your syntax:
http://quicklatex.com/
(add \usepackage{color} in the Custom LaTeX Document Preamble option to test colors)
and
here for Tex supported by mathjax.
Note: as \colorbox is displayed in red perhaps the command is not recognized, which means that your configuration contains errors. You can test with the macro require and write
\require{color}\colorbox{yellow}{$\sigma$}

Related

How to use latex standalone package with knitr?

I'm trying to generate png pictures of charts using knitr and latex standalone package. The following minimal code compiles but the output is pdf:
\documentclass[convert=true]{standalone}
\begin{document}
<<test-plot, echo=FALSE>>=
plot(rnorm(10))
#
\end{document}
Now if I want to pass some options to standalone I must use curly brackets after convert=, but simply putting something like convert={true} will produce an error:
! Argument of \#fileswith#pti#ns has an extra }.
...
Something like convert={true, ghostscript, gsexe=gswin64c, density=1200} works fine with tikz charts.
Am I overlooking something or maybe a knitr shortcoming? Any ideas on how to go around?

ST3 & LaTex: Loading locally-defined commands for in-line / live-preview of math equations with LaTex

I use a lot of locally-defined math-operators & commands in LaTex and these do not seem to be loaded for processing of the live-preview (inline preview of the math within ST3).
Is there any way I can add to the packages / commands etc that are included in use for rendering the live previews?
You can manually add it to the preview_math_template_preamble setting.
If you want to have it automatically you can try LaTeXZeta and use the LaTeXZeta: Toggle Auto Set Preview Math Template Preamble command. This parses your current view and sets that setting for you. However if you use this your manually set preamble will be ignored.
This is planed to be done by LaTeXTools, but this may take while LaTeXTools#977.

Prevent LaTex code from showing in report

In my markdown file I use the latex command
$$\pagebreak$$
to force a page break.
The page break works fine but the latex code also shows up in my report.
I want to let the code work but hide it in the report.
How can I do that?
The $$ tags are used to enter and exit math mode for writing equations. Since you are executing a typesetting command, you need to use \pagebreak without the $$ tags.
As noted in your comment, blank lines around the tag are necessary.

Markdown -> pandoc -> PDF, smart quotes not converted

My source text uses straight quotes, which pandoc converts to ``LaTeX quotes'', but those are coming through without being converted to smart quotes. I've even used the --smart option, with no change. I thought this was automatic, but apparently not. I can't find anything in my template file that looks like it would disable this. Is there another setting somewhere?
I can't find anything in my template file that looks like it would disable this.
This sounds like you have a custom template file? In this case, you might want to enable csquotes support by putting \usepackage{csquotes} into the template. Pandoc will then generate \enquote{LaTeX quotes} which might be more portable.

Change format of inline code evaluation in org-mode's LaTeX-export

I have a code block in an org document
#+NAME: result_whatever
#+BEGIN_SRC python :session data :results value :exports none
return(8.1 - 5)
#+END_SRC
which I evaluate inline:
Now, does this work? Let's see: call_result_whatever(). I'd be surprised ...
When exporting to LaTeX, this generates the following:
Now, does this work? Let's see: \texttt{3.1}. I'd be surprised \ldots{}
However, I don't want the results to be displayed in monospace. I want it to be formatted in "normal" upright font, without any special markup.
How can I achieve this?
You should be able to get it work using the optional header arguments which can be added to call_function().
I don't have LaTeX installed on this system so can't fully test the outputs to ensure they come out exactly as desired, I'm using the plain text output to compare instead. However you can use the following syntax as part of your call to modify the results.
Now, does this work? Let's see call_results_whatever()[:results raw].
I'd be surprised ...
Without the [:results raw] the output to Plain Text (Ascii buffer) is Let's see `3.0999999999999996'.. With the added results it becomes Let's see 3.0999999999999996.
For full details of the available results keywords as well as other optional header arguments for the inline blocks please see Evaluation Code Blocks and Results arguments.
this is 5 years later. apparently in org-mode 8.2 or so, a new variable was introduced (documenting in "Evaluating Code Blocks" in the org-mode manual, but this from etc/ORG-NEWS in the source tree):
*** New option: org-babel-inline-result-wrap
If you set this to the following
: (setq org-babel-inline-result-wrap "$%s$")
then inline code snippets will be wrapped into the formatting string.
so, to eliminate \texttt{}
(setq org-babel-inline-result-wrap "%s")
The problem of this type can be solved in two ways:
1: Easy does it:
A plain query-replace on the exported buffer.
Once you're in the LaTeX buffer,
beginning-of-buffer or M-<
query-replace or M-%
enter \texttt as the string that you want to replace
enter nothing as the replacement
continue to replace each match interactively
with y/n or just replace everything with !
2: But I wanna!
The second way is to nag the org-mode mailing list into
implementing a switch or an option for your specific case.
While it's necessary sometimes, it also produces a system
with thousands of switches, which can become unwieldy.
You can try, but I don't recommend.

Resources