In the following commuting diagram, I would like to draw a box containing the bottom triangle defined by nodes D, E and F. Do you know how I could do that?
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}[row sep=2.5em]
& \text{A} \\
\arrow[rightarrow]{d}{R_4}\text{B} \arrow[leftarrow]{ur}{R_1}
\arrow[dashed,leftrightarrow]{rr}{R_3} && \text{C} \\
\arrow[leftrightarrow]{rd}{R_1}\text{D}\arrow[leftrightarrow]{rr}{R_3} & &
\text{E} \arrow[leftrightarrow]{ld}{R_2}\\
& \text{F} &
\end{tikzcd}
\]
\end{document}
Searching here and there, I put together the following:
\documentclass{article}
\usepackage{amsmath}
%\usepackage{tikz-cd}
\usepackage{tikz}
\usetikzlibrary{cd}
\usetikzlibrary{fit, patterns}
\begin{document}
\[
\tikz[%remember picture,
overlay]{
\filldraw[fill=yellow!50,draw=red!50!yellow] (-.5,-3.2) rectangle (3.8,-.4);
}
\begin{tikzcd}[row sep=2.5em]
& \text{A} \\
\arrow[rightarrow]{d}{R_4}\text{B} \arrow[leftarrow]{ur}{R_1}
\arrow[dashed,leftrightarrow]{rr}{R_3} && \text{C} \\[3em]
\arrow[leftrightarrow]{rd}{R_1}\text{D}\arrow[leftrightarrow]{rr}{R_3} & &
\text{E} \arrow[leftrightarrow]{ld}{R_2}\\
& \text{F} &
\end{tikzcd}
\]
\end{document}
It outputs:
I didn't edit any of your code within \[ and \], except for adding [3em] in line 18 for the sake of vertical spacing.
The style (colors, margins) may be changed up to your personal taste!
Related
Using the wrapfig package with a table inside a section, the table's first row is not aligned with the text that wraps it. This problem is not present when working outside of a section.
\documentclass{article}
\usepackage{wrapfig}
\usepackage{lipsum}
\begin{document}
\section{Section}
\begin{wraptable}{l}{0pt}
\begin{tabular}{cccc}
A & B & C & D \\
E & F & G & H\\
\end{tabular}
\label{Mytable}\caption{This is my table.}
\end{wraptable}
\textbf{This bit of text should be aligned with the table's top row.}
\lipsum[2]
\end{document}
What this gives is:
Whereas ideally I'd like to get something like:
You could try to adjust \intextsep:
\documentclass{article}
\usepackage{wrapfig}
\usepackage{lipsum}
\begin{document}
\section{Section}
{
\setlength\intextsep{-0.4ex}
\begin{wraptable}{l}{0pt}
\begin{tabular}{cccc}
A & B & C & D \\
E & F & G & H\\
\end{tabular}
\label{Mytable}\caption{This is my table.}
\end{wraptable}
\textbf{This bit of text should be aligned with the table's top row.}
\lipsum[2]
}
\end{document}
I have a table with 3 columns where the first 2 columns are pictures and the 3rd is my comment on those pictures, but the comment "drowns", it is down at the bottom of the cell.
I have tried with m{2cm} instead of c:
\begin{tabularx}{\textwidth}{c c m{2cm}}
but no change.
\begin{table}
\caption{Caption if needed}
\label{tab:lastcheck}
\begin{tabularx}{\textwidth}{c c c}
\textbf{O-Na} & \textbf{Na-Y} & \textbf{Comments} \\
\includegraphics[width=0.3\linewidth]{pic1.png} &
\includegraphics[width=0.3\linewidth]{pic2.png} &
My comments. \\
\end{tabularx}
\end{table}
My text is at the bottom of the cell.
The graphbox provides the handy align=c option to vertically centre images:
\documentclass{article}
\usepackage{tabularx}
\usepackage{array}
\usepackage{graphicx}
\usepackage{graphbox}
\usepackage{makecell}
\renewcommand\theadfont{\bfseries}
\begin{document}
\begin{table}
\caption{Caption if needed}
\label{tab:lastcheck}
\begin{tabularx}{\textwidth}{XXX}
\thead{O-Na} & \thead{Na-Y} & \thead{Comments} \\
\includegraphics[width=\linewidth,align=c]{example-image-duck} &
\includegraphics[width=\linewidth,align=c]{example-image-duck} &
My comments. \\
\end{tabularx}
\end{table}
\end{document}
First, I'm fully aware that my code is probably not the ideal way to realize what I want to do. However I'm not a professional LaTeX User and this is the way I figured out.
I made a minimal example that hopefully works when compiled(compiler: LuaLaTeX) to display my problem.
I'm trying to make a beamer-frame with a tabularx-table, which contains in-line verbatim-environments on the one hand and equation-environments on the other. The "Y" column-type is a modified form of the "X" environment of tabularx, which I found on another Stackoverflow-thread.
The precise problem now is the following: I'd like the verbatim-expressions to be aligned with the equation-expressions or at least to be vertically centered in each cell.
As mentioned, I'm far from being an expert and I've exhausted all of my Ideas, so I'm very thankful for any form of ideas and suggestions. :)
\documentclass[c, 10pt]{beamer}
\usepackage{polyglossia}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage{placeins}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{verbatim}
\usepackage{fancyvrb}
\usepackage{nicefrac}
\usepackage{array}
\setdefaultlanguage{english}
\usetheme{JuanLesPins}
\usecolortheme{seahorse}
\newcolumntype{Y}{>{\centering\arraybackslash} X}
\begin{document}
\begin{frame}[fragile, allowframebreaks]{Symbols and Commands}
\begin{block}{\centering \large{Division}}
\begin{table}[h]
\centering
\renewcommand\baselinestretch{0.01}\selectfont
\begin{tabularx}{\textwidth}{Y Y Y}
\toprule
\multicolumn{1}{m{.3\textwidth}}{\centering Code} & \multicolumn{2}{m{.6\textwidth}}{\centering Examples}\\
\midrule
\verb|\dfrac{a}{b}| &
{\begin{equation*}
\dfrac{a}{b}
\end{equation*}} &
{\begin{equation*}
\mathrm{e}^{\dfrac{1}{k_BT}}
\end{equation*}} \\
\verb|\frac{a}{b}| &
{\begin{equation*}
\frac{a}{b}
\end{equation*}} &
{\begin{equation*}
\mathrm{e}^{\frac{1}{k_BT}}
\end{equation*}} \\
\verb|\nicefrac{a}{b}| &
{\begin{equation*}
\nicefrac{a}{b}
\end{equation*}} &
{\begin{equation*}
\mathrm{e}^{\nicefrac{1}{k_BT}}
\end{equation*}} \\
\bottomrule
\end{tabularx}
\end{table}
\end{block}
\end{frame}
\end{document}
To place unnumbered equations in a table, I would rather use inline math instead of equation environments. To get the same rendering of fractions as in equations, add \displaystyle.
Off-topic:
don't load packages multiple times
don't use fragile, allowframebreaks unless they are really necessary for the frame
floating specifier like [H] don't make sense in a document class without floating mechanism
you don't need \centering in beamer tables, they are centred by default
the syntax \large{...} is wrong, \large is a switch and does not take an argument, so it should be \large Division. Anyway it would be better to not put formatting instructions inside an macro argument, but to set the appropriate beamer template that controls the font of the block title
\documentclass[c, 10pt]{beamer}
%\usepackage{polyglossia}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage{tabularx}
%\usepackage{amsmath}
%\usepackage{amssymb}
%\usepackage{siunitx}
%\usepackage{placeins}
\usepackage{multirow}
\usepackage{booktabs}
%\usepackage{verbatim}
%\usepackage{fancyvrb}
\usepackage{nicefrac}
\usepackage{array}
%\setdefaultlanguage{english}
\usetheme{JuanLesPins}
\usecolortheme{seahorse}
\newcolumntype{Y}{>{\centering\arraybackslash} X}
\setbeamerfont{block title}{size=\large}
\begin{document}
\begin{frame}
\frametitle{Symbols and Commands}
\begin{block}{\centering Division}
\begin{table}
% \centering
% \renewcommand\baselinestretch{0.01}\selectfont
\begin{tabularx}{\textwidth}{Y Y Y}
\toprule
Code & \multicolumn{2}{c}{Examples}\\
\midrule
\verb|\dfrac{a}{b}| &
$\displaystyle\dfrac{a}{b}$ &
$\displaystyle\mathrm{e}^{\dfrac{1}{k_BT}}$ \\\addlinespace
\verb|\frac{a}{b}| &
$\displaystyle\frac{a}{b}$ &
$\displaystyle\mathrm{e}^{\frac{1}{k_BT}}$ \\\addlinespace
\verb|\nicefrac{a}{b}| &
$\displaystyle\nicefrac{a}{b}$ &
$\displaystyle\mathrm{e}^{\nicefrac{1}{k_BT}}$ \\
\bottomrule
\end{tabularx}
\end{table}
\end{block}
\end{frame}
\end{document}
I am trying to center one of the columns in a table and It says I have an extra column. The table also doesnt look correct i.e.
What it looks like:
F(t) F(s)
u(t)
1/s
e 1/(s-a)
What I expect:
F(t) F(s)
u(t) 1/s
e 1/(s-a)
I think it is because I'm trying to insert an equation in the table but I'm not sure.
Here is the code
\documentclass[12pt, letterpaper, fleqn]{article}
\usepackage{array}
\begin{document}
\begin{table}
% \setlength{\tabcolsep}{6pt}
% \renewcommand{\arraystretch}{1}
\begin{tabular}{p{0.225\textwidth} >{\centering}p{0.15\textwidth}}
\textbf{F(t)} & \textbf{F(s)} \\
\(u(t)\) & \(\frac{1}{s}\) \\
\(e^{at}\) & \(\frac{1}{s-a}\) \\
\end{tabular}
\end{table}
\end{document}
Your use of \centering to centre the column works, but it screws up the way \\ is interpreted. A correction is included in the array package documentation after using alignment switches (like \centering, \raggedright, \raggedleft, etc) using \arraybackslash:
\documentclass{article}
\usepackage{array}
\begin{document}
\begin{tabular}{ p{0.225\textwidth} >{\centering\arraybackslash}p{0.15\textwidth} }
$\mathbf{F(t)}$ & $\mathbf{F(s)}$ \\
$u(t)$ & $1 / s$ \\
$e^{at}$ & $1 / (s - a)$
\end{tabular}
\end{document}
If you remove >{\centering}, then your code should compile as expected. Post a comment otherwise! Do you want any column to have centered contents?
I need multiple equations aligned in single column of a two columned document. I have tried a mixture of both align and multiline but it does not work.
\documentclass[12pt,journal,compsoc]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
\maketitle
\section{Introduction}
\begin{align*}
p(W_{i},T_{n})&=\begin{multline*}
p(W_{i},T_{n})\\+(p(W_{i},T_{n})*k/100)
\end{multline*}\\
p(W_{i},T_{n})&=\begin{multline*}
p(W_{i},T_{n})\\+(p(W_{i},T_{n})*k/100)
\end{multline*}\\
\end{align*}
\end{document}
It gives me the error
Package amsmath Error :\begin{multline*} allowed only in paragraph mode
There's no need for multline here; a regular align will do:
\documentclass[journal,compsoc]{IEEEtran}
\usepackage{amsmath,lipsum}
\begin{document}
\section{Introduction}
\lipsum*[1]
\begin{align*}
p(W_i, T_n) ={}& p(W_i, T_n) \\
& + (p(W_i, T_n) \times k / 100) \\
p(W_i, T_n) ={}& p(W_i, T_n) \\
& + (p(W_i, T_n) \times k / 100)
\end{align*}
\lipsum*[2]
\end{document}
Since you're aligning with a line-break, it's easier to use ={}& as opposed to the traditional &= (which would require additional \phantoms to ensure proper alignment).