latex

How to get matplotlib and latex work together?

╄→尐↘猪︶ㄣ 提交于 2019-12-23 12:35:55
问题 I have the following problem and I am totally new to matplotlib and python: To produce high qualitiy plots for my thesis I want to use matplotlib and I want to use the latex commands for the axes etc. When I try the following example (from http://matplotlib.org/users/usetex.html#usetex-tutorial): import numpy as np import matplotlib.pyplot as plt # Example data t = np.arange(0.0, 1.0 + 0.01, 0.01) s = np.cos(4 * np.pi * t) + 2 plt.rc('text', usetex=True) plt.rc('font', family='serif') plt

How to get headings sans serif while preserving pdf bookmark text?

て烟熏妆下的殇ゞ 提交于 2019-12-23 12:06:04
问题 In rmarkdown I want headings with sans serif font. I can achieve this with \textsf{} latex command but later in the PDF there's no bookmark text shown. I already tried ## \textsf[Heading 1]{Heading 1} but with an error as result. Anybody got an idea how to get both? MWE: --- output: pdf_document --- ## \textsf{Heading 1} Lorem ipsum dolor sit amet, sit id rebum choro euripidis, nam ei ullum tamquam scaevola, est veniam consulatu et. Duo ex utamur atomorum. His ad dicat pericula, solet

Wrong latex rendering in matplotlib

折月煮酒 提交于 2019-12-23 12:03:42
问题 With python 2.7.12 (on Ubuntu 16.04), and matplotlib 1.5.2, the following code is rendered incorrectly: from matplotlib.pyplot import * plot([1,2],[1,1]) xlabel(r"$\beta+1$") title(r'$\alpha > \beta$') show() The xlabel renders as if it was $\partial i\Delta$ and the title renders as if it was $\rightharpoonup\Upsilon\partial$ as you can see here: My latex installation is otherwise functional. Any idea what the problem is? 回答1: As you can read in the User's Guide, about the matplotlibrc file:

Creating a footer for every page (including first!) using R markdown

你。 提交于 2019-12-23 10:26:57
问题 I'd like to add to the question Creating a footer for every page using R markdown: how do I do this for the first page of the document in addition to all the following pages? In RStudio, this code: --- title: "Test" author: "Author Name" header-includes: - \usepackage{fancyhdr} - \usepackage{lipsum} - \pagestyle{fancy} - \fancyhead[CO,CE]{This is fancy header} - \fancyfoot[CO,CE]{And this is a fancy footer} - \fancyfoot[LE,RO]{\thepage} output: pdf_document --- \lipsum[1-30] Produces this at

How to force Knitr to evaluate \Sexpr after all other code chunks

与世无争的帅哥 提交于 2019-12-23 10:20:26
问题 I am trying to write an abstract for a dynamic document, but my \Sexpr{} calls are not working. Essentially all I am trying to do is start the document off with an abstract that has p-values generated from \Sexpr{value} where value is determined "downstream" in the document. For example This works: \begin{document} <<foo>>= value = 10 @ Today I bought \Sexpr{value} Salamanders \end{document} This does not work (and what I am trying to accomplish) \begin{document} Today I bought \Sexpr{value}

Can one make Theorem numbers behave like subsubsection numbers in latex?

佐手、 提交于 2019-12-23 10:14:54
问题 I would like to ask two questions about the numbering schemes in Latex for which I am unable to find any precise reference. I will be very happy if somebody could help me out on this. Question 1) Is it possible to number theorems and subsubsections consistently as follows: 2 Section two 2.1 A subsection 2.1.1 A subsubsection Theorem 2.1.2 : Note that theorem number is behaving like the subsubsection number. 2.1.3 Next subsubsection Theorem 2.1.4 Next theorem. 2.2 Next subsection So basically

Use xtable to produce a Latex table with significance stars (***)

主宰稳场 提交于 2019-12-23 10:09:00
问题 I am currently using xtable to generate Latex tables from R. It works fine, but in one of the tables I have significance stars to some of the numbers. Something like this dataframe X: 1 2 3 4 5 Test1 Test2 Test3 a "1.34" "0.43" "-0.26" "0.13" "0.05" "3.35^{.}" "343^{***}" "3244^{***}" b "2.02" "2.17" "-3.19" "4.43" "1.43" "390.1^{***}" "31.23^{***}" "24^{***}" c "23.07" "32.1" "24.3" "3.89" "0.4" "429.38^{***}" "17.04^{***}" "2424^{***}" d "21.48" "14.45" "14.19" "22.04" "0.15" "385.17^{***}"

flyspell doesn't load with LaTeX file in emacs

风格不统一 提交于 2019-12-23 09:33:52
问题 Following this web page, I have edited my ~/.emacs file and added the line: (add-hook 'LaTeX-mode-hook 'flyspell-mode) However, flyspell doesn't start with LaTeX files. Why is that so? 回答1: Emacs is case-sensitive; the hook should be written as latex-mode-hook . Try this: (add-hook 'latex-mode-hook 'flyspell-mode) 回答2: I could not make this work: (add-hook 'LaTeX-mode-hook 'flyspell-mode) or (add-hook 'latex-mode-hook 'flyspell-mode) But then I found this: (add-hook 'LaTeX-mode-hook 'turn-on

What is a simple way to combine two Emacs major modes, or to change an existing mode?

孤者浪人 提交于 2019-12-23 08:50:08
问题 In Emacs, I'm working with a file that is a hybrid of two languages. Question 1: Is there a simple way to write a major mode file that combines two major modes? Details: The language is called "brew" (not the "BREW" of "Binary Runtime Environment for Wireless"). brew is made up of the languages R and Latex, whose modes are R-mode and latex-mode. The R code appears between the tags <% and %>. Everything else is Latex. How can I write a brew-mode.el file? (Or is one already available?) One idea

knitr and UTF8 encoding

江枫思渺然 提交于 2019-12-23 08:46:11
问题 A few days ago, I started writing on a german R-Script. Unfortunately, the following code chunk doesn't work when I knit() the document: @ <<>>= äö <- ordered(c(1,3,2,2)) @ Can anyone help me solve this problem? PS: I'm working with Linux. 回答1: Since you are using Linux, things should be easy. It is probably just a LaTeX problem; most importantly, did you specify the encoding of your document? e.g. \usepackage[utf8]{inputenc} . This works for me under Ubuntu. \documentclass[ngerman]{article}