latex

latex kable side-by-side tables “Not in outer par mode”

倖福魔咒の 提交于 2020-01-01 07:30:38
问题 I am trying to create a page with side-by-side tables. I used other SO answers to do this for a simple table ```{r start-block, include=F,echo=F} library(dplyr) library(knitr) library(kableExtra) ``` ```{r sample, echo=FALSE, results='asis'} t1 <- kable(head(mtcars)[1:3], format = "latex", booktabs = TRUE) %>% kable_styling(latex_options = c("striped"), font_size=5) t2 <- kable(head(mtcars)[4:6], format = "latex", booktabs = TRUE) %>% kable_styling(latex_options = c("striped"), font_size=5)

How to include LaTeX snippets directly in Doxygen comments?

烈酒焚心 提交于 2020-01-01 05:37:05
问题 I would like to be able to edit LaTeX parts of some Doxygen comments externally with some suitable editor. I would use that only for complex environments. To do that, I figured I can have LaTeX-only files and include them from Doxygen. I did create Doxygen aliases for \begin and \end to make the syntax compatible. (For example, I know how to set-up Emacs/AUCTex for working with LaTeX snippets that have no preamble and document structure.) Is there a way to include the contents of a .tex file

Latex and variables in plot label in R?

我的梦境 提交于 2020-01-01 04:55:32
问题 How do I use variables in Latex expressions in R? For example: plot(X, Y, main=expression(R^2)) Will put R with a nice superscripted 2 as main title. But let's say I want it to say 'R^2: 0.5', with 0.5 coming from a R variable. How do I do that? 回答1: The hack of Owen is pretty cool, but not really the common way to do that. If you use bquote , this is actually pretty easy. bquote will do the same as quote , with the exception that everything between .() will be evaluated in a specified

How to get \bm{} to work in an R markdown (to HTML) file?

元气小坏坏 提交于 2020-01-01 04:31:04
问题 My R Markdown (.Rmd) file looks like this: --- title: Foo author: Marius Hofert header-includes: - \usepackage{bm} output: pdf_document vignette: > %\VignetteEngine{knitr::rmarkdown} %\VignetteIndexEntry{Foo} --- \[ \begin{align} \bm{U}=a\bm{X}\quad\boldmath{U}=a\boldmath{X}\quad\mathbf{U}=a\mathbf{X}. \end{align} \] The output (obtained via R CMD build and the looking in ./inst/doc/*.html ) is this: For getting italics bold vectors, I would like to use \bm{X} in my .Rmd document, but it

Multiple lines in a cell of a table

不羁岁月 提交于 2020-01-01 02:49:05
问题 I have a table as shown in this figure: The LaTeX code for the table is: \begin{table} \begin{tabular}{ | c | c | } \hline \includegraphics[scale=0.45]{../0_1.eps} & 1.10 2.20 3.30 4.40 \\ \hline \end{tabular} \end{table} I would like to make the four numbers appear in different lines inside the second cell, in order to reduce its width. I wonder how to do it? EDIT: I tried \linebreak, \includegraphics[scale=0.45]{../0_1.eps} & 1.10 \linebreak 2.20 \linebreak 3.30 \linebreak 4.40 \\ But the

Automatically capitalize first letter of first word in a new sentence in LaTeX

一个人想着一个人 提交于 2020-01-01 02:35:09
问题 I know one of LaTeX's bragging points is that it doesn't have this Microsoftish behavior. Nevertheless, it's sometimes useful. LaTeX already adds an extra space after you type a (non-backslashed) period, so it should be possible to make it automatically capitalize the following letter as well. Is there an obvious way to write a macro that does this, or is there a LaTeX package that does it already? 回答1: The following code solves the problem. \let\period. \catcode`\.\active \def

Centering Text within a Multirow Cell in LaTex

旧时模样 提交于 2020-01-01 01:17:29
问题 This is probably best explained with an example. I have the following table, where the "A" cell spans two rows, and the "B" cell spans two columns. \begin{table}[htdp] \begin{tabular}{l|r|r} \multirow{2}{*}{A} & \multicolumn{2}{c}{B} \\ & B1 & B2 \\ a & b1 & b2 \\ a & b1 & b2 \\ \end{tabular} \end{table} _ _ _ _ _ _ _ _ _ _ _ _ |A |_ _ _ _B_ _ _ _| |_ _ _ _|_ _B1_ |_ _B2_ | |a | b1| b2| |a | b1| b2| |a | b1| b2| |_ _ _ _| _ _ _ |_ _ _ _| I would like to center the text in the "A" cell, only.

Mark ticks in latex in matplotlib

回眸只為那壹抹淺笑 提交于 2019-12-31 13:27:08
问题 In a plot in matplotlib I specially want to mark points on the x-axis as pi/2, pi, 3pi/2 and so on in latex. How can I do it? 回答1: The plt.xticks command can be used to place LaTeX tick marks. See this doc page for more details. import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np cos = np.cos pi = np.pi # This is not necessary if `text.usetex : True` is already set in `matplotlibrc`. mpl.rc('text', usetex = True) fig = plt.figure() ax = fig.add_subplot(1, 1, 1) t = np

Latex Table multiple row and multiple column

和自甴很熟 提交于 2019-12-31 12:55:12
问题 I'm trying to create a table in Latex but without success. I tried different solutions but no one solves my problem. I would like create a table like the picture below: Can anyone show how to do this in latex please? 回答1: One first sketch may be the following: \documentclass{article} \usepackage{multirow} \begin{document} \begin{tabular}{|c|c|c|c|c|c|} \hline \multirow{3}{*}{A} & \multicolumn{2}{c|}{User B} & % \multicolumn{2}{c|}{User C} & \multirow{3}{*}{D}\\ \cline{2-5} & \multicolumn{2}{c

References with text in LaTeX

你。 提交于 2019-12-31 10:19:09
问题 In LaTeX you can easily reference a section by using \label{} next to a section and then \ref{} to create the reference. However, the reference only includes the number of the section, or the page with \pageref{} . I would like to insert a reference containing the text of the section. Example: \section{My Section} \label{section:my} This is a reference to Section~\ref{section:my}. The output is the following: 1. My Section This is a reference to Section 1. I would like to have: This is a