latex

Recommendations for developing Sweave documents

佐手、 提交于 2019-12-18 10:13:59
问题 I'm looking to streamline my Sweave document creation, and I'd like to hear about people's current setups. I feel like the holy grail goes something like this: Editing Rnw code on one half of the screen Single keybinding compiles Sweave document and runs pdflatex View PDF on the other half of the screen; once compiled, PDF is refreshed and centered around the portion of the document you're editing If compilation has errors, replace the PDF with the results of the compilation (e.g. latex

How to draw a graph in LaTeX?

亡梦爱人 提交于 2019-12-18 09:54:58
问题 First of all, let me say I'm using LyX, though I have no problem using ERT. Secondly, what is the most simplest way to draw a simple graph like this in Latex? I've seen some documents with graphs and I've seen some examples, but I couldn't figure out how to just draw a simple graph - what packages do I need, etc? 回答1: TikZ can do this. A quick demo: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} [scale=.8,auto=left,every node/.style={circle,fill=blue!20}] \node

How to change the color of bullet-points in default environments in beamer?

血红的双手。 提交于 2019-12-18 09:46:29
问题 I am making a beamer presentation using \usetheme{Aalborg} and I want to create blocks for definitions, theorems, remarks, exercises, proofs, examples etc. It seems that the default example-environment inherits some features from the default theorem-environment. I want to be able to make itemizations and enumerations within the example-block environment such that the bullet-points have the same color as the background color of the example-block header. Right now, the color of the bullet

How to center LaTeX xtable output in full text width

自闭症网瘾萝莉.ら 提交于 2019-12-18 07:35:23
问题 I am using tufte-handout (http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/tufte-latex/sample-handout.pdf) to create a small report in latex. I have a file code.Rnw that I knit into code.tex. Below is my code.Rnw: \documentclass[12pt,english,nohyper]{tufte-handout} \usepackage{longtable} \usepackage{geometry} \begin{document} <<include=FALSE>>= library(ggplot2) library(xtable) @ \centerline{\Large\bf This is my Main Title} <<echo=FALSE,results='asis'>>= fname='plot1.pdf' pdf(fname,width=4

How to create R-markdown sections inside a R code chunk? With proper code display

筅森魡賤 提交于 2019-12-18 07:11:50
问题 I am currently writing on a report with rmarkdown and therefore I want to create sections inside a r code chunk. I figured out that this is possible with the help of cat() and results="asis" . My problem with this solution is, that my R code results and code isn't properly displayed as usual. For example --- title: "test" output: pdf_document --- ```{r, results='asis'} for (i in 1:10) { cat("\\section{Part:", i, "}") print(summary(lm(data=X, X1~X2)) $\alpha = `r X[1,i]`$ } ``` pretty much

Pandoc: Long tablerows in Markdown->PDF documents do not get linewrap

风格不统一 提交于 2019-12-18 05:47:17
问题 I am using Pandoc to generate markdown->DOCX documents with a lot of tables but would like better control over the layout. I am now trying to output markdown->PDF as well, but have run into problems with table output. In DOCX, long rows with text are simply broken up into multiple lines. In the PDF document this does not happen; a row is always a single line that do not wrap at the right margin but continue outside of the page. Normal paragraph text flows according to the right margin, so the

R Markdown Math Equation Alignment

痴心易碎 提交于 2019-12-18 03:52:37
问题 I am writing a bunch of math equations in R Markdown inside Rstudio. And I want to align the content either to the left or center. However, seems like the align will align them to the right as default. I did some google and some of them told me to use a package called ragged2e , but it did not work when I added it in. I am wondering if this should be a latex question or rmarkdown question. 回答1: I'm not quite sure what you're going for here, but line breaks, \\ go at the end of tthe line, not

References Truncated in Beamer Presentation prepared in Knitr/RMarkdown

♀尐吖头ヾ 提交于 2019-12-18 02:57:11
问题 I'm currently preparing a presentation in RStudio (using RMarkdown and Knitr, outputting to a Beamer presentation) that has quite a few references. I'm using a pretty typical YAML header: --- title: "Title" author: "Me" date: "February 27th, 2016" output: beamer_presentation csl: ../../apa.csl bibliography: ../../RefenceDesk.bib --- This presentation compiles and the references appear as they should, but unfortunately they all appear on one slide (and actually run off the page). Is there any

Export a LaTeX table from pandas DataFrame

自古美人都是妖i 提交于 2019-12-17 21:42:34
问题 Is there an easy way to export a data frame (or even a part of it) to LaTeX? I searched in google and was only able to find solutions using asciitables. 回答1: DataFrames have a to_latex method: In [42]: df = pd.DataFrame(np.random.random((5, 5))) In [43]: df Out[43]: 0 1 2 3 4 0 0.886864 0.518538 0.359964 0.167291 0.940414 1 0.834130 0.022920 0.265131 0.059002 0.530584 2 0.648019 0.953043 0.263551 0.595798 0.153969 3 0.207003 0.015721 0.931170 0.045044 0.432870 4 0.039886 0.898780 0.728195 0

How can I get PHP to compile a LaTeX document if it (www-data) can't get access to the required packages?

送分小仙女□ 提交于 2019-12-17 20:57:53
问题 I have a PHP script that compiles LaTeX documents with the use of: exec('cd /path/to/doc && /usr/bin/latexmk -pdf filename.tex'); This is working for some of my LaTeX documents but my latest document doesn't compile and a look at the log reveals: !pdfTeX error: pdflatex (file ecrm1000): Font ecrm1000 at 600 not found ==> Fatal error occurred, no output PDF file produced! Which I have found is the result of LaTeX not being able to see the required font packages. When I run the same compile