latex

LaTeX | 为学术论文排版而生【文本篇】

我是研究僧i 提交于 2019-12-03 21:11:23
这几天一直在想该按照什么样的结构去写这个 LaTeX 栏目,才能让大家更快的上手,甚至培养对 LaTeX 的 兴趣 。 LaTeX 本身非常复杂,涉及的细节非常多,不可能全部介绍,笔者能力有限,也难以做到面面俱到。因此,几经思考之后,决定突出重点,按照 入门篇 、 文本篇 、 公式篇 、 浮动体篇 、 自动化工具篇 展开本次的 LaTeX 系列。 下面就开始 LaTeX 系列的第二篇 文本篇 ,所谓 文本篇 ,主要涉及文字、段落、字体、页面设置等。 从 Hello World 说起 大家应该都有这种感觉,每当我们学习一个新东西,我们都迫不及待看到一个由自己完成的结果,因为对我们来说这意味着 至少我会用了 。只有看到希望了,后面的步子才会越迈越快。 在工程领域,这就叫做 Hello World 。学习单片机时,点亮第一个发光二极管是 Hello World ;学习C语言时,程序成功编译并输出一个字符串,叫做 Hello World ;焊接 PCB 时, LED 成功发光了,叫做 Hello World 。 那么, LaTeX 里的 Hello World 就是: 新建文件->敲代码->编译->输出PDF 。 咱,一步一步来。 新建文件 开始之前,先说一下小编的操作环境: 系统: Mac OS X Sierra 10.12.2 编译器: MacTeX 编辑器: TeXstudio 2

Difference between “Compile PDF” and knit2pdf

守給你的承諾、 提交于 2019-12-03 20:56:43
问题 I have a .Rnw file that I am able to compile into a PDF using the "Compile PDF" button in RStudio (or Command+Shift+k). However, when I use knit2pdf the graphics are not created and the complete PDF is not created. Why would this happen? How do you specifically set where the images will be stored so that pdflatex can find them? Here is an example. I am aware that this question that I posted a few days ago has a similar example, but in my mind these are two different questions. This file will

Pandoc Syntax Highlighting in PDF not working

倾然丶 夕夏残阳落幕 提交于 2019-12-03 20:23:37
pandoc --version yields: pandoc 1.12.2.1 Compiled with texmath 0.6.5.2, highlighting-kate 0.5.5.1. Syntax highlighting is supported for the following languages: actionscript, ada, apache, asn1, asp, awk, bash, bibtex, boo, c, changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css, curry, d, diff, djangotemplate, doxygen, doxygenlua, dtd, eiffel, email, erlang, fortran, fsharp, gnuassembler, go, haskell, haxe, html, ini, java, javadoc, javascript, json, jsp, julia, latex, lex, literatecurry, literatehaskell, lua, makefile, mandoc, markdown, matlab, maxima, metafont, mips,

suppress section numberings in nbconvert to latex?

情到浓时终转凉″ 提交于 2019-12-03 20:18:46
Is it possible with nbconvert --> latex --> PDF to suppress section numberings? Essentially I would like to keep the simple font size distinctions that the markdown header syntax (#, ##, etc.), and ipynb section headings provide (nbconvert --to latex appears to treat these same), and still use these to define section headings, but without the numberings. Then I also have the option of adding my own numbers manually. I can cope with losing some aspects of general latex document structuring and functionality. Ideally though I would like to keep that information, and just suppress the numberings

How can I have linebreaks in my long LaTeX equations?

喜夏-厌秋 提交于 2019-12-03 18:24:33
问题 My equation is very long. How do I get it to continue on the next line rather than go off the page? 回答1: If your equation does not fit on a single line, then the multline environment probably is what you need: \begin{multline} first part of the equation \\ = second part of the equation \end{multline} If you also need some alignment respect to the first part, you can use split : \begin{equation} \begin{split} first part &= second part #1 \\ &= second part #2 \end{split} \end{equation} Both

Including Bibliography in RMarkdown document with use of the knitcitations

蓝咒 提交于 2019-12-03 18:22:37
问题 I'm trying to use knitcitations and add bibliography to the R Markdown document that I'm drafting in R Studio. The header of my document looks like this: --- title: "Some Title" author: "Me" date: "September 2015" bibliography: bibliography.bib output: pdf_document: highlight: tango number_sections: yes toc: yes --- I want to add the bibliography at the end using the following code: ```{r generateBibliography, echo=FALSE, eval=TRUE, message=FALSE, warning=FALSE} require("knitcitations")

How do I get Emacs to fill sentences, but not paragraphs?

喜你入骨 提交于 2019-12-03 18:20:54
问题 I've seen at least two recommendations on StackOverflow to insert newlines between sentences when editing LaTeX documents. The reason being that the practice facilitates source control, diff ing, and collaborative editing. I'm basically convinced, but I'm lazy, and I don't want to have to think about it. So I'm searching for some emacs incantation to handle it for me. Could be a minor mode, could be a set of variables that need to be set. I think what I don't want is Soft wrapping of text

xtable for conditional cell formatting significant p-values of table

别等时光非礼了梦想. 提交于 2019-12-03 17:39:09
问题 I'm using xtable to generate tables to put in Latex, and was wondering if there's a way to have conditional formatting of cells so that all significant p-values are in grey? I'm using Knitr in TexShop. Here's an example using the diamonds data in ggplot2, and running a TukeyHSD test to predict carat from cut . library(ggplot2) library(xtable) summary(data.aov <- aov(carat~cut, data = diamonds)) data.hsd<-TukeyHSD(data.aov) data.hsd.result<-data.frame(data.hsd$cut) data.hsd.result I can then

usepackage and making macros in ipython notebook

可紊 提交于 2019-12-03 16:39:21
问题 How can user macros and packages be included in the latex rendered in markdown cells in ipython? e.g.: \usepackage{amssymb} \newcommand{kms}{\ensuremath{\mathrm{km~s}^{-1}} 回答1: It is possible to define macros in cells with markdown. Just put the \newcommand between $ 's: $\newcommand{kms}{{\mathrm{km~s}^{-1}}}$ (Note that I removed the \ensuremath command, as it is not accessible.) In any following statement (in the whole notebook) you can call the macro (in a markdown cell only, of course):

Way to show long division symbol )‾‾‾‾‾‾ in MathJax

我只是一个虾纸丫 提交于 2019-12-03 16:31:16
Is there a way to format long division in MathJax so it looks like this: 125 (Explanations) 4)500 4 (4 × 1 = 4) 10 (5 - 4 = 1) 8 (4 × 2 = 8) 20 (10 - 8 = 2) 20 (4 × 5 = 20) 0 (20 - 20 = 0) but obviously correctly formatted? Here is a modification of Werner's answer that gets you what you want. It uses MathJax's enclose extension to insert a MathML <menclose> element that handles the long-division symbol. $$ \require{enclose} \begin{array}{rll} 125 && \hbox{(Explanations)} \\[-3pt] 4 \enclose{longdiv}{500}\kern-.2ex \\[-3pt] \underline{4\phantom{00}} && \hbox{($4 \times 1 = 4$)} \\[-3pt] 10