latex

Insert values from a file in a latex document

这一生的挚爱 提交于 2019-12-08 00:33:40
问题 If a have a latex document, how can I read some key-value pairs from a file an insert them into the document? Something like this: Latex code: customer ID: ${customerID} Text file: customerID=123456 And the resulting .pdf file should contain the customer ID. 回答1: We can always write a perl script to expand them... defs.txt: customerID=123456 customerTel=22530000000 doc.tex: \documentclass{article} \begin{document} latex customer ID: ${customerID} and ${address} costum telphone ID: $

Latex, RenderTable in Shiny, R

本秂侑毒 提交于 2019-12-07 21:26:41
问题 I just trying to get $\10^{-1}$ in a table in Shiny, but it is not working. I'm trying the following code (thanks in advance): ui.R : require(shiny) shinyUI(tableOutput('mytable') ) server.R : require(shiny) shinyServer(function(input, output){ output$mytable <- renderTable({ df <- data.frame(A = c("$\\10^{-1}$", 33.1, 6),B = c(111111, 3333333, 3123.233)) df }, sanitize.text.function = function(x) x) }) 回答1: You can use mathJAX in shiny: require(shiny) ui <- shinyUI( fluidPage( withMathJax()

Rreport/LaTeX quality output package

本小妞迷上赌 提交于 2019-12-07 20:19:13
问题 I'm looking for some LaTeX template for creating quality output. On R-bloggers I've bumped on Frank Harrel's Rreport package. Due to my quite modest LaTeX abilities, only a user-friendly (and noob-friendly) interface should suffice. Here's a link to an official website. I'm following the instructions, but I cannot manage to install an app. I use Ubuntu 9.10, R version is 2.10.1 (updated regularly from UCLA's CRAN server), and of course, cvs is installed on my system. Now, I'd like to know if

sweave, xtable, longtable and alternating row colors…problems with `add.to.row`

旧巷老猫 提交于 2019-12-07 18:04:47
问题 This existing question covers a way to alternate row colors in a latex table by post-processing the output from print.xtable() , but I think it's possible to achieve the same thing by using the add.to.row argument of print.xtable() as described on stats.stackexchange, avoiding the need for post-processing, which is nice with Sweave. That answer deals with coloring the background of one specific row, but I think it can be extended to coloring all the odd rows. The problem I'm running into has

Trying to understand the workflow between latex, sweave and R

时光总嘲笑我的痴心妄想 提交于 2019-12-07 17:45:31
问题 Let's say I have written the following tiny .Rnw file: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{Sweave} \usepackage{tikz} \usepackage{pgf} \begin{document} <<>>= sessionInfo() @ \end{document} I then can go to R and use sweave to translate the .Rnw file into a .tex file Once this is done the latex interpreter can be called and because I used \usepackage{Sweave} Latex knows how to handle the sweave specific code tags. When I first did this procedure I got the common

How do you write special characters (“\n”,“\b”,…) to a file in Python?

别等时光非礼了梦想. 提交于 2019-12-07 15:51:57
问题 I'm using Python to process some plain text into LaTeX, so I need to be able to write things like \begin{enumerate} or \newcommand to a file. When Python writes this to a file, though, it interprets \b and \n as special characters. How do I get Python to write \newcommand to a file, instead of writing ewcommand on a new line? The code is something like this ... with open(fileout,'w',encoding='utf-8') as fout: fout.write("\begin{enumerate}[1.]\n") Python 3, Mac OS 10.5 PPC 回答1: One solution is

Figures occurring after ^ and _ macros (was: LaTeX limitation?)

拟墨画扇 提交于 2019-12-07 14:57:15
问题 I've hit an annoying problem in LaTeX. I've got a tex file of about 1000 lines. I've already got a few figures, but when I try to add another figure, It barfs with: ! Undefined control sequence. <argument> ... \sf@size \z@ \selectfont \@currbox l.937 \begin{figure}[t] If I move the figure to other parts of the file, I can get similar errors on different lines: ! Undefined control sequence. <argument> ... \sf@size \z@ \selectfont \@currbox l.657 \paragraph {A Centering Algorithm} If I comment

How can I use csquotes with LaTeX export in Org-mode?

落花浮王杯 提交于 2019-12-07 14:29:54
问题 When using csquotes quotation marks are added by csquotes according to context. This is done by marking up quotation with the \enquote macro, i.e. as \enquote{text} . When exporting to LaTeX from Org-mode quotation marks are marked up as `` and '' , e.g. as ``text'' . Can Org-mode export to LaTeX with quotations marked up by \enquote ? I found http://comments.gmane.org/gmane.emacs.orgmode/43689 where such a feature is being planned but I do not understand whether it was implemented. On a

Ipython notebook align Latex equations in Ipython.Display module

本小妞迷上赌 提交于 2019-12-07 13:08:58
问题 I am using ipython notebook to write latex equations with the following modules from IPython.display import display, Math, Latex a simple example code might look like: display(Math('a = \\frac{1}{2}')) display(Math('b = \\frac{1}{3}')) display(Math('c = \\frac{1}{4}')) Which would output: a = 1/2 b = 1/3 c = 1/4 in a pretty print format. Is there a way that I can somehow align this in columns like: a = 1/2 b = 1/3 c = 1/4 ? I know that the markup allows HTML usage, but this markup is entered

R Markdown horizontal rule that will also work with LaTeX pdf?

試著忘記壹切 提交于 2019-12-07 12:36:52
问题 I am aware that *** is Pandoc's Markdown for a horizontal rule. This horizontal line looks good on HTML, but if I knit my Markdown into a pdf the horizontal rule only runs half the width of the pdf, and it is centered. This combination just makes the horizontal rule look plain ugly. How do I properly put a horizontal rule in my R Markdown that can render properly to both HTML and pdf? Properly == full length/full width . And while I'm at it, can I format the horizontal rule (color, thickness,