How can I write quotation marks inside an Rmarkdown Latex equation? I tried the below, but the quotation marks get turned into dashes/derivative notation
$$
'Quoted Text'
$$
I tried many other suggestions like
$$
``Quoted Text"
$$
But nothing seems to display the quote marks properly.
This works for me:
$$
H_{0}: \text{Hello, } `` \text{World”}
$$
Related
I am using Xaringan slides. I want to write dollar values like $10-$5=$5 using math notation.
My code is the following:
$ \$10-\$5 = \$5 $.
However, the code will not generate the outcome in mathematical way as I wanted.
I know it works with double dollar sign $$, but I want to the result stay on the same line.
Also I don't want to put USD or CAD instead of $. Any tip?
Instead of using \$ just define a macro using latex syntax \newcommand
---
output: xaringan::moon_reader
---
# Defining inline math expression containing currency dollar sign
<!---- This is a macro for Mathjax ----->
$$\newcommand\dollars{\$}$$
<!---- --------------------------- ----->
This line conttain inline expression $\dollars10 - \dollars5 = \dollars5$
which looks like,
I want to write an equation in Jupyter notebook's markdown cell which contains text with space. I tried writing the following.
\begin{equation*}
e^{i\pi} + 1 + some text = 0
\end{equation*}
Which results like this.
How to add space between "some" and "text"? Thank you.
You can try wrapping your text in \text{}.
\begin{equation}
e^{i\pi} + 1 + \text{some text} = 0
\end{equation}
Note: this is more of a latex question, to which you can get answers from here.
In addition, you could consider " \ " and "\quad" directives to add horizontal space between elements in a LaTeX environment, also "\hskip".
When knitting my R markdown file to pdf the following error message occurs:
! Package inputenc Error: Unicode character − (U+2212)
(inputenc) not set up for use with LaTeX.
markdown
I know it has to do with the MINUS sign I'm using in some formulas, but I can't solve the problem.
I have already set the Typset LaTeX into pdf.
The formulas in question are:
\hat{\beta_1} = \frac{\sum_{i=1}^{n} (x_i - \bar{x})(y_i - \bar{y})}{\sum_{i=1}^{n} (x_i - \bar{x})^2}
and
\hat{\beta_0}=\bar{y} - \hat{\beta_1}\bar{x}
Another method to get around this error is to search and replace the offending unicode character, which can result from copy/pasting code or text into R.
For your situation, the offending symbol: − (en dash) should be replaced with - (hyphen).
Your latex can't process the en dash. It's subtle, but these characters have different widths. There are three types of horizontal punctuation “lines”:
Hyphen (-), used to hyphenate compound words and simple compound adjective (hence its name) and often used as the minus sign (-) in math
En dash (–), used to mark ranges in numbers, dates, scores and for complex compound adjectives
Em dash (—), used to separate extra information or mark a break in a sentence and other niche writing situations
This solves the problem.
title: "Your Title here"
output:
pdf_document:
latex_engine: xelatex
A little late but for anyone else who has the same problem:
Use \- instead of -
I need to type a math formula and its notations. The formula works but the notation format is not correct. Could you help me with that? Thank you.
$$
(x)\approx\frac{\phi\prime (x)\times(1-p\prime)\times p}
{\phi\prime(x)\times(1-p\prime)\times p +(1-\phi\prime(x)\times
p\prime\times(1-p)}\\
$$
$$p$$: notation1
$$p\prime$$: notation2
$$\phi$$: notation3
$$\phi\prime$$: notation4
You are using the $$ which forces a new line around an equation. Using a single $ creates an inline expression, which is what you want. So change the code to be:
$$
(x)\approx\frac{\phi\prime (x)\times(1-p\prime)\times p}
{\phi\prime(x)\times(1-p\prime)\times p +(1-\phi\prime(x)\times
p\prime\times(1-p)}\\
$$
$p$: notation1
$p\prime$: notation2
$\phi$: notation3
$\phi\prime$: notation4
Alternatively, to break the lines a little better you can use the <br/> tag
$$
(x)\approx\frac{\phi\prime (x)\times(1-p\prime)\times p}
{\phi\prime(x)\times(1-p\prime)\times p +(1-\phi\prime(x)\times
p\prime\times(1-p)}\\
$$
$p$: notation1<br/>
$p\prime$: notation2<br/>
$\phi$: notation3<br/>
$\phi\prime$: notation4<br/>
You also mentioned right align - for this you'll need to use a div and align it, like so:
$$
(x)\approx\frac{\phi\prime (x)\times(1-p\prime)\times p}
{\phi\prime(x)\times(1-p\prime)\times p +(1-\phi\prime(x)\times
p\prime\times(1-p)}\\
$$
<div align="right">
$p$: notation1<br/>
$p\prime$: notation2<br/>
$\phi$: notation3<br/>
$\phi\prime$: notation4<br/>
</div>
Note that the latter two solutions will only really work in the live notebook and I presume HTML output (Markdown may work too). If you plan to convert to latex/pdf afterwards then you'll need the first solution or the solution below:
$$
(x)\approx\frac{\phi\prime (x)\times(1-p\prime)\times p}
{\phi\prime(x)\times(1-p\prime)\times p +(1-\phi\prime(x)\times
p\prime\times(1-p)}\\
$$
$\begin{align}
p: notation1
\newline
p\prime: notation2
\newline
\phi: notation3
\newline
\phi\prime: notation4
\end{align}
$
With this solution you can have either left alignment (using single $ around the align environment) or centre alignment (using $$ around the align environment) but I don't think you can have right alignment. Plus this way the notations are in maths font rather than regular font, which may not be desired.
How can I make a LaTex macro which replaces each
\and by the word "and"
\or by the word "or"
so that the nouns are not in italics?
\text{and} or \text{or}
If you insist on a macro, just use the normal LaTeX \newcommand.
In math mode \mbox{} gives the argument upright (roman) typesetting.