Long equation spread across the whole page in two column format - latex

I use the strip environment for a long equation in a two-column page format, but the equation number appears at the edge of the first column and not after the equation ends.
\begin{strip}
\begin{equation}
f_{k+i,j} \left(
\bar{A}^{k+i+1}\hat{x}_{-1} +
\bar{A}^{i+1}\bar{B}_k \begin{bmatrix} \Tilde{y}_0 \\ \vdots \\ \Tilde{y}_{k-1} \end{bmatrix} +
\bar{B}_{i+1} \left(
\begin{bmatrix} {y}_k \\ CA\hat{x}_k \\ \vdots \\ CA^i\hat{x}_k \end{bmatrix}
+
\begin{bmatrix} M_s\delta_k \\ M_s\delta_{k+1} \\ \vdots \\ M_s\delta_{k+i} \end{bmatrix} \right) \right) \leq h_{k+i,j}
- \sqrt{f_{k+i,j}\Sigma_{\zeta_i}f_{k+i,j}^T}\Phi^{-1}\left(1 - \frac{\alpha}{s_{k+i}}\right)
- \max_{\eta \in \Gamma} f_{k+i,j}\bar{A}^{k+i+1}\eta
\end{equation}
\end{strip}

Related

How to fit a Latex table to a given document size?

I tried a lot of things to fit the table to the given size of the document. Unfortunately it did not work without destroying the format.
\documentclass[10pt,a4paper,twocolumn]{article}
\usepackage[top=30pt,bottom=30pt,left=48pt,right=120pt]{geometry}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[latin1]{inputenc}
\begin{document}
\begin{table}[!htbp] \centering
\begin{tabular} {#{\extracolsep{1pt}}lcc}
\\[-1.8ex]\hline
& \multicolumn{2}{c}{\textit{First Stage Regression}} \
\cr \cline{2-3}
\hline \\[-1.8ex]
\\[-1.8ex] & \multicolumn{1}{c}{ \% foreign born
while in college} & \multicolumn{1}{c}{\% foreign born
while in high
school} \\
\\[-1.8ex] & (1) & (2) \\
\hline \\[-1.8ex]
1960 Distribution
of Immigrants across States & 3.613e+07$^{***}$ & 1.204e+07 $^{***}$ \\
& (8.26e+04) & (2.74e+04) \\
\hline \\[-1.8ex]
Observations & 3,588,372 & 3,588,372 \\
$R^2$ & 0.051 & 0.051 \\
Adjusted $R^2$ & 0.051 & 0.051 \\
Residual Std. Error & 26.649(df = 3588371) & 8.834(df = 3588371) \\
F Statistic & 191184.297$^{***}$ (df = 1.0; 3588371.0) & 193328.460$^{***}$ (df = 1.0; 3588371.0) \\
\hline
\hline \\[-1.8ex]
\textit{Note:} & \multicolumn{2}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
\end{tabular}
\end{table}
\end{document}
Does anyone have an idea? Thanks
I suggest to use a table* environment so that your table will span over both columns.
You can safe some room by making very long cells into multi-line cells. The tabularray package makes this easy.
Are you 100% sure that your document is really encoded in latin1? That sounds very usual this millennium...
You should load the hyperref package after the other packages.
\documentclass[10pt,a4paper,twocolumn]{article}
\usepackage[top=30pt,bottom=30pt,left=48pt,right=120pt]{geometry}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{tabularray}
\usepackage{hyperref}
\begin{document}
\begin{table*}
\begin{tblr}{
colspec={X[l]X[c]X[c]},
}
\hline
& \SetCell[c=2]{} \textit{First Stage Regression} & \\
\cline{2-3}
& \% foreign born while in college (1) & \% foreign born while in high school (2)\\
\hline
\SetCell[r=2]{} 1960 Distribution of Immigrants across States & 3.613e+07$^{***}$ & 1.204e+07$^{***}$ \\
& (8.26e+04) & (2.74e+04) \\
\hline
Observations & 3,588,372 & 3,588,372 \\
$R^2$ & 0.051 & 0.051 \\
Adjusted $R^2$ & 0.051 & 0.051 \\
Residual Std. Error & 26.649(df = 3588371) & 8.834(df = 3588371) \\
F Statistic & 191184.297$^{***}$ (df = 1.0; 3588371.0) & 193328.460$^{***}$ (df = 1.0; 3588371.0) \\
\hline
\hline
\textit{Note:} & \SetCell[c=2]{r} $^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01 \\
\end{tblr}
\end{table*}
\end{document}
Just add the \resizebox parameter before tabular and don't forget to add the brackets before and after the tabular. You can put it in different ways, such as \resizebox{\textwidth}{!}, \resizebox{0.5\textwidth}{!}, \resizebox{3cm}{!}, ...
\documentclass[10pt,a4paper,twocolumn]{article}
\usepackage[top=30pt,bottom=30pt,left=48pt,right=120pt]{geometry}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[latin1]{inputenc}
\begin{document}
\begin{table}[!htbp] \centering
\resizebox{\textwidth}{!}{
\begin{tabular} {#{\extracolsep{1pt}}lcc}
\\[-1.8ex]\hline
& \multicolumn{2}{c}{\textit{First Stage Regression}} \
\cr \cline{2-3}
\hline \\[-1.8ex]
\\[-1.8ex] & \multicolumn{1}{c}{ \% foreign born
while in college} & \multicolumn{1}{c}{\% foreign born
while in high
school} \\
\\[-1.8ex] & (1) & (2) \\
\hline \\[-1.8ex]
1960 Distribution
of Immigrants across States & 3.613e+07$^{***}$ & 1.204e+07 $^{***}$ \\
& (8.26e+04) & (2.74e+04) \\
\hline \\[-1.8ex]
Observations & 3,588,372 & 3,588,372 \\
$R^2$ & 0.051 & 0.051 \\
Adjusted $R^2$ & 0.051 & 0.051 \\
Residual Std. Error & 26.649(df = 3588371) & 8.834(df = 3588371) \\
F Statistic & 191184.297$^{***}$ (df = 1.0; 3588371.0) & 193328.460$^{***}$ (df = 1.0; 3588371.0) \\
\hline
\hline \\[-1.8ex]
\textit{Note:} & \multicolumn{2}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
\end{tabular}
}
\end{table}
\end{document}

How do I change a separator in tabular just for one row in LaTeX?

I'd like to change a column separator just for one row in my tabular.
For now, the = is set up as a separator between columns, for the last row I would like to change it for a \vdots.
Thanks a lot.
EDIT:
I did what #achim suggested and it works, but still is there any ''nicer'' solution?
here is a proposition to use the align environment to align the equation you need and write all the math in one same environment rather than in a tabular.
It only require the package amsmath in the beginning of the file.
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\begin{document}
Proposal
\begin{align*}
\text{vychozi tvar} & ~ & y' + p(x) y &= q(x) \\ \hline
\text{reseni} & ~ & y' + p(x)y &= q(x) / \cdot e^{\int p(x)\, \dx} \\
& ~ & \left(y\cdot e^{\int p(x)\, \dx}\right) &=
q(x) \cdot e^{\int p(x)\, \dx} / \text{integrace} \\
& ~ & y\cdot e^{\int p(x)\, \dx} &= \int q(x) \cdot e^{\int p(x)\, \dx}\, \dx \\
& ~ & ~ &\vdots \\
\end{align}
\end{document}
The alignement is made with & sign and you can specify if it is = after or \vdots. You can still use text in this environment, juste use \text{lorem ipsum}.
This environment can number the line, juste remove * in \begin{align*}.
I tried to copy the bit of code you provided in picture, in future, include it in your question so we can solve issue quickly. Sorry if I made typos in my copy, I hope this suite your case.
EDIT : You may want to add the vertical line between the left text and your equations...here is a second solution, however I can't manage to align the equation all along
\begin{tabular}{l|l}
vychozi tvar & \parbox{0.3\linewidth}{%
\begin{align*}
y' + p(x) y &= q(x) \\
\end{align*}}\\ \hline
reseni & \parbox{0.3\linewidth}{%
\begin{align*}
y' + p(x)y = q(x) / \cdot e^{\int p(x)\, \dx} \\
\end{align*}} \\
~ & \parbox{0.3\linewidth}{
\begin{align*}
\left(y\cdot e^{\int p(x)\, \dx}\right) &=
q(x) \cdot e^{\int p(x)\, \dx} / \text{integrace} \\
y\cdot e^{\int p(x)\, \dx} &= \int q(x) \cdot e^{\int p(x)\, \dx}\, \dx \\
~ &\vdots & ~ \\
\end{align*}} \\
\end{tabular}

Showing entries of a vector one after another

Overflow Community! I'm working on a Latex Beamer - Document and I cant think of a nice looking solution for what I am planning to do.
So I have a vector, which entries I want to show one after another. But the right bracket is missing in the first steps when I'm using \pause in my equation, which looks quite ugly. So what I want is both brackets to be visible, while the vectors entries are not. Do you guys have a solution for this?
\documentclass[mathserif, 10pt]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,bm,amsthm,graphicx,skmath}
\begin{document}
\begin{frame}
\frametitle{Function $g$}
\[
g(x)=\begin{pmatrix}
g_1(x)\\ \vdots \\ g_n(x) \\ g_{n+1}(x) \\ \vdots \\ g_{2n}(x) \\ g_{2n+1}(x)\\ \vdots \\ g_{3n}(x)
\end{pmatrix}
\pause = \begin{pmatrix}
x_1^2 + x_{n+1}^2 - 1 \\ \vdots \\ x_n^2 + x_{2n}^2 - 1\\ \pause -x_{2n+1}\\ \vdots \\ -x_{3n} \\ \pause x_{2n+1}-L \\ \vdots \\x_{3n}-L
\end{pmatrix}
\]
\end{frame}
\end{document}
\pause is a very crude command, for more fine control you can use commands like \visible<...>{...}.
Please note that you don't need graphicx, amsmath or amsthm with beamer and that the mathserif option is obsolete. This should have caused a warning with a detailed description how this option should be replaced, please don't ignore such warnings.
\documentclass[10pt]{beamer}
\usepackage[utf8]{inputenc}
\usefonttheme[onlymath]{serif}
\usepackage{amsmath,bm,amsthm,
%graphicx,
skmath}
\begin{document}
\begin{frame}
\frametitle{Function $g$}
\[
g(x)=\begin{pmatrix}
g_1(x)\\ \vdots \\ g_n(x) \\ g_{n+1}(x) \\ \vdots \\ g_{2n}(x) \\ g_{2n+1}(x)\\ \vdots \\ g_{3n}(x)
\end{pmatrix}
\visible<2->{ = \begin{pmatrix}
x_1^2 + x_{n+1}^2 - 1 \\ \vdots \\ x_n^2 + x_{2n}^2 - 1\\ \visible<3->{ -x_{2n+1}}\\ \visible<3->{\vdots} \\ \visible<3->{-x_{3n}} \\ \visible<4->{x_{2n+1}-L} \\ \visible<4->{\vdots} \\\visible<4->{x_{3n}-L}
\end{pmatrix}}
\]
\end{frame}
\end{document}
You'll want Beamer's \uncover command, which hides its argument but still makes it take up space:
\[
g(x)=\begin{pmatrix}
g_1(x)\\ \vdots \\ g_n(x) \\ g_{n+1}(x) \\ \vdots \\ g_{2n}(x) \\ g_{2n+1}(x)\\ \vdots \\ g_{3n}(x)
\end{pmatrix}
\pause = \begin{pmatrix}
x_1^2 + x_{n+1}^2 - 1 \\ \vdots \\ x_n^2 + x_{2n}^2 - 1\\ \uncover<3->{-x_{2n+1} \\ \vdots \\ -x_{3n}} \\ \uncover<4->{x_{2n+1}-L \\ \vdots \\x_{3n}-L}
\end{pmatrix}
\]
The bit in the angle brackets (e.g. <3->) indicates that the argument should be uncovered (visible) on frames 3 onwards.
You can also use \visible instead, the difference being:
The \visible command does nearly the same as \uncover. However one difference occurs if the command \setbeamercovered{transparent} has been used to make covered text “transparent” instead, \visible still makes the text completely “invisible” on non-specified slides.

How can I format long division of polynomials in MathJax?

I try to format my math like this in MathJax:
How can I do long division of polynomials in MathJax?
Old post, but I couldn't find an answer elsewhere, so here's how I solved this issue with two side-by-side arrays. Couldn't figure out how to make the lines shorter as I could in LaTex, but this was good enough for me:
<span class="math display">\[\begin{array}{r}
\\
x^2 - 3) \\
\phantom{.} \\
\phantom{.} \\
\phantom{.} \\
\phantom{.} \\
\phantom{.} \\
\phantom{.} \\
\phantom{.} \\
\phantom{.} \\
\phantom{.} \\
\end{array}
\begin{array}{rrrrrr}
& & x^3 & -2x^2 & +4x & -6 \\ \hline
x^5 & -2x^4 & + x^3 & &-8x & +18 \\
-x^5 & &+3x^3 \\ \hline
& -2x^4 & +4x^3 \\
& 2x^4 & &-6x^2 \\ \hline
& & 4x^3 & -6x^2 & -8x \\
& & -4x^3 & &+12x \\ \hline \\
& & &-6x^2 & +4x & +18 \\
& & & 6x^2 & & -18 \\ \hline
& & & & 4x
\end{array}\]</span>

Latex (texmaker) table \cline

I'm having this problem with creating table in Latex.
So I want to create a table but when I use \cline it gives me
error ! Paragraph ended before \#cline was complete.\par
and much more.
I'm using \usepackage{multiraw}, \usepackage{tabulary} for tables.
The table:
\begin{table}
\centering
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
\multirow{2}{*}{laktóza $ [\mathrm{mmol \cdot dm^{-3}}] $} & \multirow{2}{*}{} & \multicolumn{5}{c|}{ONPG $ [\mathrm{mmol \cdot dm^{-3}}] $} \\ \
& & \multicolumn{1}{c|}{0,10} & \multicolumn{1}{c|}{0,25} & \multicolumn{1}{c|}{0,50} & \multicolumn{1}{c|}{1,0} & \multicolumn{1}{c|}{2,0} \\ \
\hline
\multirow{2}{*}{0} & $ V_{ONPG} \enskip [\mathrm{\mu l}] $ & 10 & 25 & 50 & 100 & 200 \\ \cline{2-7}
& $ V_{roztok \enskip Z} \enskip [\mathrm{\mu l}] $ & 990 & 975 & 950 & 900 & 800 \\ \ \hline
\end{tabular}
\end{table}
Thanks for every help.
\documentclass{article}
\usepackage{multirow}
\usepackage{tabulary}
\begin{document}
\begin{table}
\centering
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
\multirow{2}{*}{laktóza $ [\mathrm{mmol \cdot dm^{-3}}] $} & \multirow{2}{*}{} & \multicolumn{5}{c|}{ONPG $ [\mathrm{mmol \cdot dm^{-3}}] $} \\
& & \multicolumn{1}{c|}{0,10} & \multicolumn{1}{c|}{0,25} & \multicolumn{1}{c|}{0,50} & \multicolumn{1}{c|}{1,0} & \multicolumn{1}{c|}{2,0} \\
\hline
\multirow{2}{*}{0} & $ V_{ONPG} \enskip [\mathrm{\mu l}] $ & 10 & 25 & 50 & 100 & 200 \\
\cline{2-7}
& $ V_{roztok \enskip Z} \enskip [\mathrm{\mu l}] $ & 990 & 975 & 950 & 900 & 800 \\
\hline
\end{tabular}
\end{table}
\end{document}
This code compiles and the output should now look like in your thoughts:
Some \ after \\ and before \hline were not supposed to be and produced errors (compare lines 5, 6 and 9 of your code with mine).

Resources