How do I determine file encoding in OS X?
Using the -I (that’s a capital i) option on the file command seems to show the file encoding. file -I {filename}
Using the -I (that’s a capital i) option on the file command seems to show the file encoding. file -I {filename}
After you install HyperSnips, use its command HyperSnips: Open snippets directory to open the directory where you will put your snippets. Snippets in all.hsnips will be available in all language files. You can also put your snippets into something like latex.hsnips or Latex.hsnips in the same directory and both versions work for me. Modifying the … Read more
knitr (>= v1.5) supports subfigures. You can use the chunk option fig.subcap. Here is a minimal example. \documentclass{article} \usepackage{subfig} \begin{document} <<fig-sub, fig.cap=’two plots’, fig.subcap=c(‘one plot’, ‘the other one’), out.width=”.49\\linewidth”>>= plot(1:10) plot(rnorm(10), pch=19) @ \end{document}
I prefer MathJax over solutions that choose to render images (which causes aliasing problems). MathJax is an open source Javascript rendering engine for mathematics. It uses CSS and Webfonts instead of images or flash and can render LaTeX or MathML. That way you don’t have problems with zoom and it’s even screenreader compatible.
Recent versions of rmarkdown and pandoc In more recent versions of rmarkdown, the settings of margins can be done in the YAML header via the top-level element geometry. What you specify in the geometry tag will be piped into the LaTeX template that ships with Pandoc via the following LaTeX snippet $if(geometry)$ \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry} $endif$ For … Read more
I always have text.usetex = True in my matplotlibrc file. In addition to that, I use this as well: mpl.rcParams[‘text.latex.preamble’] = [ r’\usepackage{siunitx}’, # i need upright \micro symbols, but you need… r’\sisetup{detect-all}’, # …this to force siunitx to actually use your fonts r’\usepackage{helvet}’, # set the normal font here r’\usepackage{sansmath}’, # load up the … Read more
You can use the output format bookdown::pdf_document2 instead of pdf_document, and the syntax for referencing a figure is \@ref(fig:chunk-label); see the documentation for details: https://bookdown.org/yihui/bookdown/figures.html
You can start by defining the template tex file as a string: content = r”’\documentclass{article} \begin{document} … \textbf{\huge %(school)s \\} \vspace{1cm} \textbf{\Large %(title)s \\} … \end{document} ”’ Next, use argparse to accept values for the course, title, name and school: parser = argparse.ArgumentParser() parser.add_argument(‘-c’, ‘–course’) parser.add_argument(‘-t’, ‘–title’) parser.add_argument(‘-n’, ‘–name’,) parser.add_argument(‘-s’, ‘–school’, default=”My U”) A bit … Read more
IPython notebook uses MathJax to render LaTeX inside html/markdown. Just put your LaTeX math inside $$. $$c = \sqrt{a^2 + b^2}$$ Or you can display LaTeX / Math output from Python, as seen towards the end of the notebook tour: from IPython.display import display, Math, Latex display(Math(r’F(k) = \int_{-\infty}^{\infty} f(x) e^{2\pi i k} dx’))
The CRAN package latex2exp contains a TeX function that translate LaTeX formulas to R’s plotmath expressions. You can use it anywhere you could enter mathematical annotations, such as axis labels, legend labels, and general text. For example: x <- seq(0, 4, length.out=100) alpha <- 1:5 plot(x, xlim=c(0, 4), ylim=c(0, 10), xlab=’x’, ylab=TeX(r'($\alpha x^\alpha$, where $\alpha … Read more