latex

In Pandoc, how do I add a newline between authors through the YAML metablock without modifying the template?

拟墨画扇 提交于 2019-12-08 08:03:59
问题 I am trying to add a a couple of authors to a report I am writing. Preferably, the second author would appear on a new line after the first. I know I can modify the template to add a new field or the multiple author example given in the Pandoc readme. However, I wonder if there is any character I can use to insert a new line between authors directly in the metablock. So far I have tried \newline , \\ , | with newline and space, <br> , <div></div> , and making the author list a string with

Using apaTables or apaStyles packages with knitr

若如初见. 提交于 2019-12-08 08:03:45
问题 Problem Social scientists format tables and documents with APA style. There are packages like stargazer and xtable (here is an extensive list) that provide clean table formatting for those using latex and knitr . However , these packages do not conform to APA style rules in all cases. Building and formatting tables from scratch is time consuming. Fortunately, there are two R packages for creating tables and documents compliant with APA style guidelines: apaStyle and apaTables . Unfortunately,

writing “latex command” in the Matlab figure comment

旧城冷巷雨未停 提交于 2019-12-08 06:51:18
问题 I have a figure in Matlab, inside the figure i would like to write comments on the figure. the comment include latex formula; for example, I want to write this comment on my figure $$ \vec{R} = 2 $$ here is an example that I found when I searched; clear all; close all; clc; figure ms = 8; fontSize = 18; xx = 0:.1:1; plot(xx,sin(xx)) xlabel('P_{fa}', 'fontsize', fontSize); ylabel('P_{m}', 'fontsize', fontSize); I want it looks like as in the attached figure below: Note: I searched in last

Rotate stargazer table in knitr

此生再无相见时 提交于 2019-12-08 06:44:37
问题 I am using knitr to write a .Rnw file and the stargazer packages to build tables for regression outputs. For the most part it is working quite well but I would like to rotate a table 90 degrees like I would easily be able to do in LaTeX using \usepackage{sidewaystable} outside of .Rnw \documentclass{article} \begin{document} <<table1, echo=FALSE, message=F, warning=F, results="asis">>= library(stargazer) lm1 <- lm(mpg ~ wt, data = mtcars) lm2 <- lm(mpg ~ hp, data = mtcars) lm3 <- lm(mpg ~ cyl

add vertical space above and below figures/code chunks

↘锁芯ラ 提交于 2019-12-08 05:45:37
问题 I am knitting from Rmd to PDF. I'd like to add vertical space above and below figures/code chunks to separate this content from body text. I've done this successfully for Rnw files by adding the following to my preamble see this answer: \renewenvironment{knitrout}{\vspace{1em}}{\vspace{1em}} I tried adding this line to header-includes in the yaml section of my Rmd file, but it did not work. I turned on the option to keep the interim tex file, and I see there is no knitrout environment in the

Align panel.background instead of plot.background with document margins

泄露秘密 提交于 2019-12-08 05:26:26
问题 I would like to have plots generated by ggplot2 inserted into a LaTeX document with the panel as wide as \textwidth (or \columnwidth in a two column document). I have the following solution: \documentclass{article} \usepackage{lipsum, graphicx} <<knitrOpts, echo=FALSE>>= knitr::opts_chunk$set(echo = FALSE, fig.show = 'hide', fig.width=general_fig_width <- 5, fig.height=3, out.width = out_width <- "5in", out.height="3in" ) @ \usepackage{geometry} \setlength{\textwidth}{\Sexpr{out_width}} <

LaTeX: creating new section headings

拟墨画扇 提交于 2019-12-08 04:07:17
问题 I want to create a new section like heading using a custom global counter. The intended behaviour is to have a \rule command which defines a rule, that can be used in several sections and subsection, but uses a custom global counter. Example: 1. Section 1.1 SubSection Rule 1: bla Rule 2: foo 2. Section Rule 3: foobar 2.1 subsection Rule 4: yet another one I tried two different things: 1.) create a custom command from scratch \newcounter{rule} \addtocounter{rule}{0} % set them to some other

Formula's or symbols in footnotes using knitr and kableExtra

南楼画角 提交于 2019-12-08 04:00:21
问题 Does anyone know how to place a formula, a (weird) character, or words in italic within a sentence of a footnote of a table? I'm creating a pdf file with Rmarkdown and kableExtra. But stuff like $Y_{t-1}$ or $p < .001$ (since I want the p to be italic) does not work. Or should I really learn xtable? 回答1: The trick is 1. to escape latex code and special characters four times, e.g. \\\\frac , 2. to set option escape=FALSE in footnote() . --- title: "Untitled" output: pdf_document --- ```{r tab}

Latex Multiline Equations

我的未来我决定 提交于 2019-12-08 03:06:01
问题 Is it possible to get multline like behavior within a gather environment? I have a set of equations in a gather environment, but one of them is too long, and I'd like to split it up onto two lines where the first line is left-aligned and the second line is right-aligned (just like multline). If there is a way of aligning individual lines within the gather or split environment (like flushleft or flushright but functional in mathmode) this would solve the problem. 回答1: The mathtools package has

How can I compile first 2 pages of 24 pages in a Latex document?

空扰寡人 提交于 2019-12-08 00:52:32
问题 My work has over 24 pages in Latex. I need only the abstract and introduction in pdf. How can you compile only the first two pages? 回答1: I'd just make a new file with only the abstract and introduction and compile that. Actually, if this is not just a one-time thing, I'd use three files: absintro.tex : \begin{abstract} ... \end{abstract} ...introduction... onlyabsintro.tex : ... \begin{document} \include{absintro.tex} \end{document} fullreport.tex : ... \begin{document} \include{absintro.tex}