latex

R code in LaTeX in YAML before_body include

僤鯓⒐⒋嵵緔 提交于 2019-12-05 13:57:15
I have a LaTeX section that I put at the top of my knitr generated PDF document. I achieved this by using the YAML options output: pdf_document: includes: before_body: file.tex file.tex contains code like this \textsf{Reporting: `r 2+2`} but this doesn't work. Is there another way that I can get this value? Passing in a parameter is fine if that's possible. Thanks! You have to knit file.tex . I suggest you rename file.tex , e.g., to file.Rnw , and in your main R Markdown document: ```{r, include=FALSE} writeLines(knitr::knit_child('file.Rnw'), 'file.tex') ``` 来源: https://stackoverflow.com

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

给你一囗甜甜゛ 提交于 2019-12-05 13:39:48
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, etc.) without getting into much CSS which I know nothing about. Make a tex file, say header.tex ,

If-Else Statement in knitr/Sweave using R variable as conditional (Part 2)

若如初见. 提交于 2019-12-05 13:22:07
I am extending a question I posted here: If-Else Statement in knitr/Sweave using R variable as conditional I would like to use an if-else syntax in LaTeX so that, depending on the value of an R variable (say x), one of two LaTeX text paragraphs are output. If x>0, then the LaTeX paragraph has a figure and a table. However, if x<0, then the LaTeX paragraph has just a figure (and no table). I have a MWE that works and is based on the checked answer at the previous post: \documentclass[12pt,english,nohyper]{tufte-handout} \usepackage{tabularx} \usepackage{longtable} \begin{document} <<setup, echo

How to get rid of navigation bars in beamer?

孤者浪人 提交于 2019-12-05 13:17:37
How can I remove the navigation bar of sections and subsections on the top of each slide generated from a beamer latex file? I'm using the package beamerthemesplit. The stupid way to make sure the presentation structure does not show up, (independent of theme) comment out the \section and \subsection commands. Beamer has different themes you can use, some of which include that navigation bar and some of which don't. The default theme, for example, doesn't include any navigation bar. All the themes available with Beamer are described in the user guide ; just pick one that suits your

How can I change fonts in a beamer presentation that uses Sweave?

别来无恙 提交于 2019-12-05 12:15:09
When I include \usepackage{Sweave} in the preamble of a beamer presentation, beamer ignores changes to font, e.g., \usepackage{helvet} . Here is a minimal example: \documentclass[professionalfonts]{beamer} \usepackage[T1]{fontenc} \usepackage{helvet} \usepackage{Sweave} \begin{document} \begin{frame} Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. \end{frame} \end{document} The text is set in computer modern,

TOC and figure side by side in a slide

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 11:41:44
I want to put a figure and the TOC side by side in one slide where it would look like TOC Figure I have tried to include them each in a minipage respectively and then put them both in a figure environment. But the result does not look good, for the TOC is formatted as a paragraph, instead of an itemize look. So, does anybody have a better solution? Thanks in advance. PS I use beamer for creating slides. Have you tried the following: \frame{ \begin{columns} \column{.5\textwidth} \tableofcontents \column{.5\textwidth} \begin{figure}[h] \centering HERE-FIGURE \caption{Testfigure} \label{fig:a}

Can MathJax render a LaTeX math expression as an image?

你离开我真会死。 提交于 2019-12-05 08:02:18
I know that MathJax can render LaTeX mathematical expressions as text. Can MathJax render LaTeX math expressions as images? I can't find any information about this in the help documentation. If so, could you tell me the details? Thanks! I assume you're asking whether MathJax can render math expression as images. Unfortunately, the answer is no: the only output formats are HTML-with-CSS and MathML, according to the documentation . Of course, you could try to convert the resulting HTML+CSS to an image using some other method/library. You can configure MathJax to produce output using SVG

running Sublime Text build with latex instead of pdflatex from LaTeXTools plugin

☆樱花仙子☆ 提交于 2019-12-05 07:41:54
问题 In the build file supplied with the LatexTools plugin for Sublime Text, I modified the statement "cmd": ["latexmk", "-e", "\\$pdflatex = 'pdflatex %O -interaction=nonstopmode -synctex=1 %S'", "-f", "-pdf"] by replacing the second instance of pdflatex with latex. My question is, how do I specify whether I want to use "dvipdfm" or "dvi2ps + ps2pdf". If someone could provide a sample build file for this purpose, that would be most helpful. 回答1: After a bit of trial and error, I finally have the

RMarkdown / pandoc fails to knit Pdf with latex color commands

对着背影说爱祢 提交于 2019-12-05 07:21:21
问题 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

Latex 文档格式化

安稳与你 提交于 2019-12-05 06:18:07
title: "Latex 文档格式化" author: 李龙翔 date: "Nov 22, 2019" subject: "Markdown" keywords: [latex, format] toc: false CJKmainfont: 'SimSun' --- Latex 文档格式化 一直以来从未注意过 latex 文档如何保持缩进的一致性,许多编辑器在提供自动补全时也无法提供正确的缩进,最终使得文档十分混乱。 在 TexLive 中包含有 tex 文档格式化工具 latexindent,但是这个脚本是使用 perl 缩写,运行时需要一些第三方模块,在 osx 系统中直接运行会出现错误。 $ latexindent Can't locate Log/Dispatch/File.pm in @INC (you may need to install the Log::Dispatch::File module) (@INC contains: /usr/local/texlive/2019/texmf-dist/scripts/latexindent /usr/local/Cellar/perl/5.30.0/lib/perl5/site_perl/5.30.0/darwin-thread-multi-2level /usr/local/Cellar/perl/5.30