latex

Latex - extract substring/ignore characters

那年仲夏 提交于 2019-12-04 22:18:59
问题 I have the following problem. I have defined a macro, \func as follows \newcommand{\func}[1]{% do something with #1 X #1 Y } I now want to define another macro \newcommand{\MyFunc}[1]{ % parse #1 and if it contains "\func{....}", ignore all except this part % otherwise ignore #1 } Can someone tell me how to implement \MyFunc ? Here is what should happen: \MyFunc{123abcdefg} % should print nothing \MyFunc{123\func{abcd}efg} % should print X abcd Y I can only change the code of \MyFunc . \func

First-line paragraph indenting in PDFs using R Markdown

我只是一个虾纸丫 提交于 2019-12-04 21:45:25
问题 I'm hoping this is a question with a simple answer. I am using Rmarkdown/knitr to author a PDF document (in RStudio). Many LaTeX classes (like article) automatically indent the first line of a paragraph of text, but Rmarkdown does not, nor can I figure out a way to do so. Here's a simple example: --- title: "minimal" author: "prison rodeo" output: pdf_document --- This is an R Markdown document. I would like this paragraph to be first-line indented, but it is not. Using > indents the entire

LaTeX equations do not render in google Colaboratory when using IPython.display.Latex

可紊 提交于 2019-12-04 21:32:53
问题 In a regular jupyter notebook, running, for example, the following: from IPython.display import display, Math, Latex display(Math(r'F(k) = \int_{-\infty}^{\infty} f(x) e^{2\pi i k} dx')) produces an equation rendered in LaTeX (via Mathjax). Even though LaTeX works fine in markdown cells, LaTeX equations produced as above do not seem to render in Google Colaboratory. The same happens to the output of functions for example from qutip, which would normally render in latex (for example, qutip

RMarkdown / pandoc fails to knit Pdf with latex color commands

删除回忆录丶 提交于 2019-12-04 20:40:44
Mac Os: 10.11.6 R version: 3.3.1 MacTex: 2016 / TexLive: 6.2.2 RMarkdown: 1.0.9014 Knitr: 1.14 Pandoc: 1.17 RMarkdown fails to knit PDF when latex commands such as: \textcolor{blue}{Character String} are present in the .rmd file. The error output is: /usr/local/bin/pandoc +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.pdf --template ~/R/3.3/library/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --latex-engine /Library/TeX/texbin/pdflatex --variable graphics=yes --variable 'geometry:margin

figure caption centering in nbconvert?

这一生的挚爱 提交于 2019-12-04 19:43:54
I have cells underneath figures in an ipython notebook that contain figure caption text. I would like them to be centre('center')-aligned. I use "< center >" in the markdown, which gives exactly the appearance I'm after in the notebook. But when nb-converting to latex, the text gets shunted over to the left. So is there a way to get nbconvert to recognize text alignment in markdown cells when converting to latex? Thanks. You have actually asked two different questions: is there a way to get nbconvert to recognize text alignment in markdown cells figure caption (centering) in nbconvert ad 1) To

LaTeX multicolumn block in Pandoc markdown [duplicate]

萝らか妹 提交于 2019-12-04 19:17:35
问题 This question already has answers here : Slides with Columns in Pandoc (6 answers) Closed 2 years ago . I want to convert a markdown file to html and pdf using pandoc. For the pdf file, which is intended for printing, I'd like to render a block of (narrow) text in two column format. This is what I came up with (and doesn't work): --- papersize: a4 documentclass: article header-includes: - \usepackage{multicol} ... H1 ============== H2 - A -------------- \begin{multicols}{2} ### H3 - a Blah

How to only show table caption once in “list of table” for a table split onto multiple pages

此生再无相见时 提交于 2019-12-04 19:08:46
I am using R packages ( xtable and knitr ) and Latex packages ( longtable and hyperref ) to prepare a document. One of my tables is very long and splits onto multiple pages. It turned out that the "List of Table" shows every page number at which this table appears, but all hyperlinks bring me to the beginning of this table. My question is, in "List of Table" how can I just show the first page number at which this table appears. \documentclass{article} \usepackage{longtable} \usepackage{hyperref} <<setup, include=FALSE, cache=FALSE>>= library(knitr) library(xtable) @ \begin{document}

Using CSS when converting Markdown to PDF with Pandoc

余生颓废 提交于 2019-12-04 18:58:54
问题 I'm trying out Pandoc on OS X, and results thus far are impressive. One blocking problem, however, is getting CSS styles to work on inline code samples. I'm converting from Markdown to PDF. I have this string in my source: * Create a simple HTML document (<span class="filename">simple.html</span>) and load it into the browser via the file system I've also tried this: * Create a simple HTML document (`simple.html`{.filename}) and load it into the browser via the file system I'd like to apply

Sublime Text 3 LaTeXTools plugin won't compile on Ubuntu

扶醉桌前 提交于 2019-12-04 18:58:24
I've been a fan of the LaTeXTools plugin for Sublime Text for a while. However, the author recently updated the plugin, and it will no longer build my LaTeX documents. I'm wondering if anyone else has had this problem and knows how to fix it? Here's the full console output that I'm getting: [Compiling /home/tingley/Dropbox/testtex.tex] TraditionalBuilder: Invoking latexmk... COULD NOT COMPILE! Attempted command:latexmk -cd -e $pdflatex = 'pdflatex -interaction=nonstopmode -synctex=1 %S %O' -f -pdf testtex.tex Build engine: Traditional Builder I'm using Sublime Text 3 on Ubuntu 13.10 with

Using sympy's latex() function without calculating the input

喜欢而已 提交于 2019-12-04 18:50:34
I want to get latex output from a sympy expression without calculating the expression. For instance if I do latex((2+3)/7) the output would be 5/7 (with latex), but what I am after is for it to just output (2+3)/7 with latex. Like this: \frac{2+3}{7} You can manually adjust the long_frac_ratio long_frac_ratio: The allowed ratio of the width of the numerator to the width of the denominator before we start breaking off long fractions. The default value is 2. >>> latex(e,long_frac_ratio=3) '\\frac{2 + 3}{7}' You can try to sympify the expression with keyword evaluate=False : >>> latex(S('(2+3)/7'