latex

knitr and UTF8 encoding

怎甘沉沦 提交于 2019-12-23 08:46:06
问题 A few days ago, I started writing on a german R-Script. Unfortunately, the following code chunk doesn't work when I knit() the document: @ <<>>= äö <- ordered(c(1,3,2,2)) @ Can anyone help me solve this problem? PS: I'm working with Linux. 回答1: Since you are using Linux, things should be easy. It is probably just a LaTeX problem; most importantly, did you specify the encoding of your document? e.g. \usepackage[utf8]{inputenc} . This works for me under Ubuntu. \documentclass[ngerman]{article}

Iterating through a character/string array in LaTeX

拟墨画扇 提交于 2019-12-23 08:43:06
问题 This is a continuation of my question posted earlier (Outputting character string elements neatly in Sweave in R). I have an array of strings, and am trying to output each element into LaTeX. I am able to achieve that using the following code: \documentclass[12pt,english,nohyper]{tufte-handout} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{longtable} \usepackage{wrapfig} \usepackaage{hyperref} \usepackage{graphicx} \usepackage[space]{grffile} \usepackage{geometry}

Select only some items from a list in LaTeX

给你一囗甜甜゛ 提交于 2019-12-23 08:40:09
问题 I have a LaTeX document which is basically one big enumerate environment, with a few hundreds of items. I want to be able to issue a command like \printitems{2,5,12,45-48} which will output only the requested items. A similar command \onlyslides is a part of slides.cls , but I cannot figure out what goes on there and adapt it to my needs. I can replace the list of item 's with a list of environments, like \begin{myitem} ... \end{myitem} \begin{myitem} ... \end{myitem} with a \newcounter etc.

Conditional font color R Markdown

扶醉桌前 提交于 2019-12-23 04:31:45
问题 I am unable to find a way to include dynamic font colors in R Markdown based on the value of a variable (>0, ==0, or <0). Could anyone help? I tried an if statement where the return value is latex syntax, but that errored out. To be clear, I'm looking for PDF output. Here's what I tried: ```{r setup, include=FALSE} x <- 4 ``` This is an R Markdown document. `r if (x>0) {\textcolor{red}{Markdown}} else if (x==0) {\textcolor{blue}{Markdown}} else {\textcolor{yellow}{Markdown}}` In this dummy

Conditional font color R Markdown

我怕爱的太早我们不能终老 提交于 2019-12-23 04:31:03
问题 I am unable to find a way to include dynamic font colors in R Markdown based on the value of a variable (>0, ==0, or <0). Could anyone help? I tried an if statement where the return value is latex syntax, but that errored out. To be clear, I'm looking for PDF output. Here's what I tried: ```{r setup, include=FALSE} x <- 4 ``` This is an R Markdown document. `r if (x>0) {\textcolor{red}{Markdown}} else if (x==0) {\textcolor{blue}{Markdown}} else {\textcolor{yellow}{Markdown}}` In this dummy

Matplotlib xlabel in Arial with one word italicised

和自甴很熟 提交于 2019-12-23 03:33:18
问题 I want to create a matplotlib figure with an x-axis label that is in Arial font, and has one word italicised. I can create figures with x-axis labels in latex-font with one word italicised; I can also create figures with x-axis labels in Arial, as long as I have either the entire label italicised or the entire label normal; but I can't get part of the xlabel in Arial italicised and the other part in arial normal. I'm mostly trying permutations of the following code: from matplotlib import

【漫漫科研路/pgfplots】解决绘制色温图数据量大出现的内存限制

守給你的承諾、 提交于 2019-12-23 00:48:41
在科研论文写作中,经常会遇到画色温图,3D图。此时一般输入的数据量比较大,导致在Latex中使用Tikz画图时出现内存不足的情况。常常报错如下: ! TeX capacity exceeded, sorry [main memory size=5000000]. 参考pgfplots手册中的第六章,我们有以下解决方案: 使用LuaTex进行编译 有些版本不含LuaTex 对输入数据采样降低数据量 不是从本质上解决问题,降低了精度 使用其它软件画图,e.g., MATLAB 增大LaTex的编译内存 本文主要介绍如何在MacOS系统中Texlive平台下,克服内LaTex内存限制。关于在Linux和MiKTEX环境下,pgfplots手册已给了说明,这里不再赘述。 解决办法:在Texlive安装目录中找到texmf.cnf文件并编辑: 其安装目录在: /usr/local/texlive/2018/texmf-dist/web2c/texmf.cnf 注意:/usr/local/texlive/2018/texmf.cnf也有相同的文件,编辑这个文件无法解决问题 其内容修改如下: 注意:修改的内存大小不能超过实际内存大小,我的是8G. 最后,打开终端进入安装目录下,执行 sudo texhash 若发生文件不可写的情况,可以使用chmod 777 来更改文件读写权限。 下面

markdown支持的latex

让人想犯罪 __ 提交于 2019-12-22 22:35:12
markdown支持latex 1 公式标记 1.1 行内公式 1.2 行间公式 2 常用基础Latex公式 2.1 希腊字母 2.2 上标和下标 2.3 括号 2.4 求和、积分、分式、根式 2.5 公式内部的空格 2.6 顶部符号 2.7 特殊函数与符号 3. 表格 4. 矩阵 4.1 矩阵基本用法 4.2 矩阵加括号 4.3 矩阵的省略元素 4.4 增广矩阵 5. 公式对齐 6. 分段函数 7.公式序号标记 8.公式颜色 公式排版建议 01 不要在再指数或者积分中使用`\frac` 02 使用 `\mid` 代替 `|` 作为分隔符 03 多重积分 04 方程组 Reference 1 公式标记 1.1 行内公式 行内公式(inline)表示公式嵌入到文本段中,用 $...$ 书写, $ 的旁边不能有空格 。 以 \转义的如\alpha 等左右两边要留有空格 ,否则无法比解析。 1.2 行间公式 行间公式表示公式独立成为一个段落,用 $$...$$ 书写。 2 常用基础Latex公式 2.1 希腊字母 中文名称 名称 大写显示 LaTex 小写显示 LaTex 阿尔法 alpha A A A $A$ α \alpha α $\alpha$ 贝塔 beta B B B $B$ β \beta β $\beta$ 伽马 gamma Γ \Gamma Γ $\Gamma$ γ

xtable package: Skipping some rows in the output

廉价感情. 提交于 2019-12-22 22:22:56
问题 In the xtable output, if I want some rows to have nothing in them I will put NA 's in the elements of the matrix that correspond to the row that I want skipped. However this will lead to xtable output of something like & & & & & & & & \\ . What I want to know is how do I make it so it's ONLY \\ for that row that I wish to skip. 回答1: Still not sure whether I understand right but I give it a shot. The most important assumption I'm making here is that your multicolumn rows in that template are

How can the backticks (`) printed around these tables be escaped?

不打扰是莪最后的温柔 提交于 2019-12-22 18:35:02
问题 In Align multiple tables side by side, a user asks about aligning tables, and the (very good) answer provided involves using latex in a chunk with the results returned as is to LaTeX. This is correct for that users question. I am curious if this can be easily converted into an inline (i.e. not in chunk) solution. \begin{table}[!htb] \begin{minipage}{.5\linewidth} \caption{} \centering, `r t1`, \end{minipage}% \begin{minipage}{.5\linewidth} \centering \caption{}, `r t2`, \end{minipage} \end