latex

Compile latex from python

巧了我就是萌 提交于 2019-12-09 12:01:23
问题 I have made some python function for compiling passed string as pdf file using latex. The function works as expected and has been quite useful, therefore I look for ways to improve it. The code which I have: def generate_pdf(pdfname,table): """ Generates the pdf from string """ import subprocess import os f = open('cover.tex','w') tex = standalone_latex(table) f.write(tex) f.close() proc=subprocess.Popen(['pdflatex','cover.tex']) subprocess.Popen(['pdflatex',tex]) proc.communicate() os.unlink

Formula's or symbols in footnotes using knitr and kableExtra

强颜欢笑 提交于 2019-12-09 08:33:30
Does anyone know how to place a formula, a (weird) character, or words in italic within a sentence of a footnote of a table? I'm creating a pdf file with Rmarkdown and kableExtra. But stuff like $Y_{t-1}$ or $p < .001$ (since I want the p to be italic) does not work. Or should I really learn xtable? The trick is 1. to escape latex code and special characters four times, e.g. \\\\frac , 2. to set option escape=FALSE in footnote() . --- title: "Untitled" output: pdf_document --- ```{r tab} library(knitr) library(kableExtra) df <- data.frame(v1=rnorm(6), v2=runif(6), v3=rbinom(6, 1, .33), row

MathML, Latex or similar for web-based WYSIWYG editor [closed]

瘦欲@ 提交于 2019-12-09 06:08:05
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I am looking for a web-based WYSIWYG (or WYSIWYM) editor like TinyMCE or WMD Editor (used to write this question) that supports users to write mathematical formulas. I have looked at LaTeX a little bit but it has a learning curve and I am not sure if support for MathML is extensive. Ideally I would also like to

Greasemonkey script for inserting math in gmail

邮差的信 提交于 2019-12-09 05:59:59
问题 I wish an easy way to communicate mathematical equations with gmail. There's a javascript script called AsciiMath, which should translate Tex-like equations into standard mathML. I thought that it would be nice to use this script with GM. I thought that before sending the email, this script would convert all the TeX-like equations in your email to MathML. Thus the reader which is using FF (or IE with MathPlayer installed) would be able to easily read those equations. Ideally, I wish to

Format number using LaTeX notation in Python

◇◆丶佛笑我妖孽 提交于 2019-12-09 05:36:57
问题 Using format strings in Python I can easily print a number in "scientific notation", e.g. >> print '%g'%1e9 1e+09 What is the simplest way to format the number in LaTeX format, i.e. 1\times10^{+09}? 回答1: The siunitx LaTeX package solves this for you by allowing you to use the python float value directly without resorting to parsing the resulting string and turning it into valid LaTeX. >>> print "\\num{{{0:.2g}}}".format(1e9) \num{1e+09} When the LaTeX document is compiled, the above code will

Jupyter notebook: How to \usepackage{} for LaTeX

守給你的承諾、 提交于 2019-12-09 04:40:55
问题 I would like to know how I can \usepackage{} for LaTeX in Jupyter notebook. 回答1: Not sure this is the only or even best way of doing it, but it seems to work. Write a template file ("mytemplate.tplx") in the same directory as your ipynb notebook file ("mynotebook.ipynb"). mytemplate.tplx looks like: ((*- extends 'article.tplx' -*)) ((* block packages *)) ((( super() ))) \usepackage{amsmath} \usepackage{newtxtext,newtxmath} ((* endblock packages *)) Build your pdf LaTex file by executing the

LaTeX math in github wikis

好久不见. 提交于 2019-12-09 04:34:05
问题 Is it possible to include LaTeX-style math in any way with github repo wikis? Googling implies github no longer allows things like MathJax, but most references are years old. What (if any) alternatives are there to including LaTeX-formatted math in github wikis? 回答1: You can use chart.apis.google.com to render LaTeX formulas as PNG. It work nicely with Githhub's markdown: Example (Markdown): The ratio of the momentum to the velocity is the relativistic mass, m. ![f1] And the relativistic mass

Latex - Inserting a reference in a figure's caption

99封情书 提交于 2019-12-09 04:32:42
问题 In Latex, I want to add a reference in the legend of a figure, like: \begin{figure} ... \caption{This is the legend of this figure (reprinted from \cite{something}).} ... \end{figure} but the citation is not allowed to be placed in the the caption, only in the text. My bibliography is working on any other places of the text. Any suggestions how to do this? Thanks 回答1: Solution found: write \protect\cite{ref} instead of just \cite{ref} Or even shorter: '{\cite{ref}}' 回答2: As the accepted

Creating a latex table from ftable object in R

£可爱£侵袭症+ 提交于 2019-12-09 04:31:16
问题 Let me create some data before I ask my question. my.data <- data.frame(A = sample(seq(1,100,by=5),10,replace=TRUE),W = rnorm(10),X =sample(1:10),Y = sample(c("yes", "no"), 10, replace = TRUE),Z=sample(c('a','b','c','d'),10,replace=TRUE)) attach(my.data) my.d <- xtabs(W~Z+Y+A);my.d table.data <- ftable(my.d) result1 <- round(table.data,2) result1 looks like .. A 6 11 16 26 71 76 86 91 Z Y a no 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 yes 0.00 0.56 0.00 0.00 0.00 0.79 0.00 0.01 b no 0.61 0.00

Any Python Library Produces Publication Style Regression Tables

丶灬走出姿态 提交于 2019-12-09 04:04:02
问题 I've been using Python for regression analysis. After getting the regression results, I need to summarize all the results into one single table and convert them to LaTex (for publication). Is there any package that does this in Python? Something like estout in Stata that gives the following table: 回答1: Well, there is summary_col in statsmodels ; it doesn't have all the bells and whistles of estout , but it does have the basic functionality you are looking for (including export to LaTeX):