LaTeX: stack three lines in math mode - math

Hey,
I'm writing a formula with three indexes i,j,k.
At the end of the line I'd like to put this:
i=1,...,a
j=1,...,b
k=1,...,n
But I'd like it in smaller font and stacked above each other. Can someone tell me a command which can accomplish this? \mbox can't do math mode, I think.

Try the \substack command:
z_i = a_j + b_k \qquad \substack{
i=1,\dots,a \\
j=1,\dots,b \\
k=1,\dots,n}

Related

Layout of a formula in a bookdown file

In my *.Rmd file I'm writing something like this
$\text{Dia}_i = \max_{x, y \in C_i} d(x,y)$
And I was expecting this
but when doing bookdown::render_book(...) and controlling the results in my browser firefox I got
I found that this has something to do with the namelimits (first picture) and nonamelimits (second picture) but unfortunately I have no clue how to change the outcome.
Question: What kind of code chunk I have to add that I can switch between the two notations?
Thanks a lot in advance!
Edit_1
Can I mix these two types?! The goal is to have an inline formula with the desired apperance.
Edit_2
This is my Code - the three dots (...) are the magic/unknown code
And this is my desired output
But sadly I get this
My wish summerized
This should work, following https://stackoverflow.com/a/61979164/13249862:
Add this to your YAML header:
header-includes:
- \newcommand{\argmax}{\mathop{\mathrm{max}}\limits}
Then, you can write both equations:
This $\text{Dia}_i = \argmax_{x, y \in C_i} d(x,y)$, or this $\text{Dia}_i = \max_{x, y \in C_i} d(x,y)$.
Result:

Logarithmic x and y axis for image plot

I need to do this in a different way, since pcolor produces diagonal lines in the output file
h=pcolor(rand(16)); %The actual data comes from hist3
set(h,'EdgeColor','none');
colormap(gray(256));
set(gca,'yscale','log');
set(gca,'xscale','log');
print('test.png','-dpng','-r4800'); %Gives diagonal lines in text.png
Is there a simple workaround the bug. I use the FLTK backend.
Update
Switching to gnuplot removes the diagonal lines, but adds vertical and horizontal lines, but changes increases the plot margins too much.
Here is a "solution" to the bug. The idea is to disable anti-aliasing for graphics.
gswrapper.sh
#!/bin/bash
ARGS=()
ARGS+=("-dGraphicsAlphaBits=1")
for var in "$#"; do
[ "$var" != '-dGraphicsAlphaBits=4' ] && ARGS+=("$var")
done
gs "${ARGS[#]}"
Octave script:
h=pcolor(rand(16)); %The actual data comes from hist3
set(h,'EdgeColor','none');
colormap(gray(256));
set(gca,'yscale','log');
set(gca,'xscale','log');
print('test.png','-dpng','-r600','-G./gswrapper.sh');

R Markdown Math Equation Alignment

I am writing a bunch of math equations in R Markdown inside Rstudio. And I want to align the content either to the left or center. However, seems like the align will align them to the right as default.
I did some google and some of them told me to use a package called ragged2e, but it did not work when I added it in. I am wondering if this should be a latex question or rmarkdown question.
I'm not quite sure what you're going for here, but line breaks, \\ go at the end of tthe line, not the beginning, and the aligmnent operator is &. So this:
$$
\begin{aligned}
AR(p): Y_i &= c + \epsilon_i + \phi_i Y_{i-1} \dots \\
Y_{i} &= c + \phi_i Y_{i-1} \dots
\end{aligned}
$$
produces this:
left align the formula
$\begin{aligned}
AR(p): Y_i &= c + \epsilon_i + \phi_i Y_{i-1} \dots \\
Y_{i} &= c + \phi_i Y_{i-1} \dots
\end{aligned}$
&...& show in the line ; $$...$$ display out;
Wow. That works great! Thank you for the help! This worked perfectly in R Studio Markdown.
My code was in an ordered list and is as follows:
$\begin{aligned}
\lim_{x \to \infty}\frac{2x-5}{4x^4}=0\\
\end{aligned}$
$\begin{aligned}
\frac{d}{dx}\left( \int_{0}^{x}f(u)\,du\right)=f(x)\\
\end{aligned}$

Unix C Shell Scripting printf help

Attempting to print out a list of values from 2 different variables that are aligned correctly.
foreach finalList ($correctList $wrongList)
printf "%20s%s\n" $finalList
end
This prints them out an they are aligned, but it's one after another. How would I have it go through each item in each list and THEN go to a new line?
I want them to eventually appear like this:
Correct Incorrect
Good1 Bad1
Good2 Bad2
Good3 Bad3
Good comes from correctList
Bad comes from wrongList
Getting rid of \n makes it Like this:
Good1 Bad1 Good2 Bad2
I just want 2 columns.
You can iterate over both lists at the same time like this:
# Get the max index of the smallest list
set maxIndex = $#correctList
if ( $#wrongList < $#correctList ) then
set maxIndex = $#wrongList
endif
set index = 1
while ($index <= $maxIndex)
printf "%-20s %s\n" "$correctList[$index]" "$wrongList[$index]"
# index++
end
try getting rid of the \n
I believe the pr(1) command with the -m option will help do what you want. Look at its man page to eliminate the header/trailer options and set the column widths.
Also, I recommend you not use the C-Shell for scripting; you'll find the sh-syntax shells (sh, bash, ksh, etc) are more consistent and much easier to debug.

Annuity or Angle Operation Symbol in LaTeX

How do I set the symbol for the angle or annuity operation in LaTeX? Specifically, this is the actuarial a angle s = (1-vs)/i.
I've looked at Life's Contingency's Package, various Actuarial Outpost forum threads, and the Comprehensive Symbol List for LaTeX, and combined the best into the following macros:
\DeclareRobustCommand{\lcroof}[1]{
\hbox{\vtop{\vbox{%
\hrule\kern 1pt\hbox{%
$\scriptstyle #1$%
\kern 1pt}}\kern1pt}%
\vrule\kern1pt}}
\DeclareRobustCommand{\angle}[1]{
_{\lcroof{#1}}}
You can then use this macro for the problem's example by typing
$a\angle{s}$
If you need a full set of actuarial symbols, you should use the Life's Contingency's Package lifecon. Using lifecon, you can set the above by typing
$a_{\lcroof{s}}$
For a very comprehensive list of LaTeX symbols, see The Comprehensive LaTeX Symbol List. Worth printing out and keeping under your pillow. Page 95 has some code that may do what you want.
I had the same problem with the actuarial symbol and the subscript/superscript, sooo I made a package to make my life easier and help other.
Plus, I’ve add some shortcut to save time.
The project page and the CTAN.
All you need is the actuarialsymbol package.
At the beginning of the code you have to write
\usepackage{actuarialsymbol}
For the sub/superscript
\actsymb['subscripLeft']['superscriptL']{<middle>}{'subscriptR'}{'superscriptR'}
Example of output:
Example of shortcut for actuarial symbol :
I've been doing some typesetting for a professor of mine and it turns out I needed some help producing the accumulated value of an annuity notation.
I asked this question on the tex stack exchange here
The result that Heiko Oberdiek produced was
\documentclass{article}
\usepackage{siunitx}
\makeatletter
\newcommand*{\NegationLike}[1]{%
\mathop{%
\mathpalette\#NegationLike{#1}%
}%
% A little space is added automatically,
% if a math ord atom follows.
}
\newdimen\BarLineWidth
\newcommand*{\#NegationLike}[2]{%
% #1: math style
% #2: argument
\vbox{%
% The rule thickness of \overline or \underline
% is available in the font dimen register 8
% of the math family 3 of the current size.
\BarLineWidth=%
\the\fontdimen8%
\ifx\displaystyle#1\textfont
\else\ifx\textstyle#1\textfont
\else\ifx\scriptstyle#1\scriptfont
\else\scriptscriptfont
\fi\fi\fi
3\relax
% The rule at the top
\hrule height\BarLineWidth
% Move the box with the vertical line
% as height as the top of the upper line
% to get a better corner.
Which produces:
accumulated value of annuity
\annu
A good list of latex symbols can be found here http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf

Resources