LateX Beamer : Putting a tikzpicture next to a picture - latex

I'd like to put tikzpicture next to a picture on a beamer but right now the tikzpicture is way below the slide ! Here is my code :
\begin{frame}{Frame name}
\begin{columns}[t]
\column{.5\textwidth}
\centering
\begin{tikzpicture}{Tikzpicture name}
%my tikzpicture here
\end{tikzpicture}
\column{.5\textwidth}
\centering
\includegraphics[width=100px, height=200 px]{PICTURE.jpg}
\end{columns}
\end{frame}

You can use T as alignment option for the columns to make sure the very top of the columns is aligned instead of the baseline of the first lines.
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
\frametitle{Frame name}
\begin{columns}[T]
\begin{column}{.5\textwidth}
\centering
\begin{tikzpicture}{Tikzpicture name}
\draw (0,0) circle [radius=1cm];
\end{tikzpicture}
\end{column}
\begin{column}{.5\textwidth}
\centering
\includegraphics[width=100px, height=200 px]{example-image-duck}
\end{column}
\end{columns}
\end{frame}
\end{document}

Related

Latex: how to align subcaptions on the top left and caption to the right of the figures

I am using LaTeX to write a report and I'm going crazy to get a result like
with subcaptions (a), (b), (c) align to the top left of the subfigures and caption on the right of the figure.
I've already tried with floatrow and subcaption, but I've never obtained the result I want.
MWE:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{floatrow}
\usepackage{subfig}
\floatsetup[figure]{style=plain,subcapbesideposition=top}
\begin{figure*}
\ffigbox[\FBwidth]
{\begin{subfloatrow}
\sidesubfloat[]{\includegraphics[width=.5\linewidth]{image1}\label{fig:a}}%
\sidesubfloat[]{\includegraphics[width=.5\linewidth]{image2}\label{fig:b}}%
\end{subfloatrow}}
{\caption{Two figures}\label{}}
\end{figure*}
\end{document}
Here some starting point with the subcaption package (the exact dimensions might need some tweaking to nicely align with the surrounding text)
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\captionsetup[subfigure]{font={bf,small}, skip=1pt, margin=-0.7cm, singlelinecheck=false}
\begin{document}
\begin{figure*}
\hfill
\begin{minipage}[b]{.63\textwidth}
\begin{subfigure}{\textwidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-duck}
\end{subfigure}\par
\begin{subfigure}{\textwidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-duck}
\end{subfigure}
\end{minipage}
\quad
\begin{minipage}[b]{.3\textwidth}
\caption{some caption with aligns at the bottom}\label{key}
\end{minipage}
\end{figure*}
\end{document}

Align Molecules in chemfig

I want to align the reaction equation to the black line shown in the picture.
\documentclass[11pt,a4paper,oneside]{scrartcl}
\usepackage{chemfig}
\begin{document}
\begin{figure}
\begin{center}
\schemestart
\chemfig{*6(-=(*6(-(=O)-NH-NH-(=O)-))-=(-NH_2)-=)}\qquad
\+
\chemfig{H_2O_2}\qquad
\arrow(.mid east--.mid west){-U>[][$\mathrm{N_2}$]}\qquad
\chemfig{*6(-=(-COO^{-})-(-COO^{-})=(-NH_2)-=)}\qquad
\+
Licht
\schemestop
\end{center}
\caption{Reaktion von Luminol zu 3-Aminophtalatdianion}
\end{figure}
\end{document}
A bit hacky, but you could do
\documentclass[11pt,a4paper,oneside]{scrartcl}
\usepackage{chemfig}
\begin{document}
\begin{figure}[htbp]
\centering
\setchemfig{+ vshift=0.5cm}
\schemestart
\chemfig{*6(-=(*6(-(=O)-NH-NH-(=O)-))-=(-NH_2)-=)}\qquad
\+
\raisebox{0.5cm}{\chemfig{H_2O_2}}\qquad
\arrow(.north east--.north west){-U>[][$\mathrm{N_2}$][-2.4cm]}\qquad
\chemfig{*6(-=(-COO^{-})-(-COO^{-})=(-NH_2)-=)}\qquad
\+
\raisebox{0.5cm}{Licht}
\schemestop
\caption{Reaktion von Luminol zu 3-Aminophtalatdianion}
\end{figure}
\end{document}
Another possibility, using only commands from the "chemfig" package, where I used two "invisible arrows" to adjust the position of the "+"
\documentclass[11pt,a4paper,oneside]{scrartcl}
\usepackage{chemfig}
\begin{document}
\begin{figure}[htbp]
\centering
\schemestart
\chemfig{*6(-=(*6(-(=O)-NH-NH-(=O)-))-=(-NH_2)-=)}
\arrow{0}[,.1]\+
\chemfig{H_2O_2}
\arrow{-U>[][\chemfig{N_2}]}
\chemfig{*6(-=(-COO^{-})-(-COO^{-})=(-NH_2)-=)}
\arrow(.east--.west){0}[,.1]\+ Licht
\schemestop
\caption{Reaktion von Luminol zu 3-Aminophtalatdianion}
\end{figure}
\end{document}
Since the first molecule has branches above and below the rings, and the reaction product has branches just above, and knowing that the "chemfig" aligns the molecules by their "center of mass", a simple way to adjust the position of the resulting molecule of the reaction is by placing an "invisible bond" (-[6,,,,draw=none) at the bottom of this molecule.
\documentclass[11pt,a4paper,oneside]{scrartcl}
\usepackage{chemfig}
\begin{document}
\begin{figure}[htbp]
\centering
\schemestart
\chemfig{*6(-=(*6(-(=O)-NH-NH-(=O)-))-=(-NH_2)-=)}
\arrow{0}[,.1]\+
\chemfig{H_2O_2}
\arrow{-U>[][\chemfig{N_2}]}
\chemfig{*6(-(-[6,,,,,draw=none])=(-COO^{-})-(-COO^{-})=(-NH_2)-=)}
\arrow(.east--.west){0}[,.1]\+ Licht
\schemestop
\caption{Reaktion von Luminol zu 3-Aminophtalatdianion}
\end{figure}
\end{document}

How to remove automatic numbering of figure in LaTex?

I would like the caption of my figure to be "Figure A". Is there a way to remove the automatic numbering of the figures?
\documentclass[jou]{apa7}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\renewcommand{\figurename}{Figure A}
\centering
\caption{Title}
\includegraphics[width=0.5\textwidth]{test.png}
\end{figure}
\end{document}
With the code above, the caption is "Figure A 1".
Thank you in advance!
Two quick hacks, either you can temporarily remove the number or you can latex do the numbering with capital letters:
\documentclass[jou]{apa7}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\renewcommand{\figurename}{Figure A}
\renewcommand{\thefigure}{}
\centering
\caption{Title}
\includegraphics[width=0.5\textwidth]{example-image-duck}
\end{figure}
\begin{figure}
\renewcommand{\thefigure}{\Alph{figure}}
\centering
\caption{Title}
\includegraphics[width=0.5\textwidth]{example-image-duck}
\end{figure}
\end{document}

Beamer : overlayarea inside a figure?

in my Beamer presentation, I would like to dynamically switch images in a figure environnement.
More precisely, my figure contains 9 subfloats presented 3x3 and each of them should switch between two images during the presentation.
In order to avoid some "tilting" between the different elements, I thought that it would be a good idea to use an overlayarea inside each subfloat.
Sadly, when used in an figure environment, the overlayarea seems to behave very odd : every thing I put in it appear outside the overlayarea ??
Here is a very short example :
\documentclass[9pt, aspectratio=43]{beamer}
\usepackage [francais]{babel}
\usepackage [T1]{fontenc}
\usepackage [utf8]{inputenc}
\usepackage[position=top]{subfig}
\usepackage{pdfpages}
\begin{document}
\begin{frame}
%% This works fine : 123 appears INSIDE the overlayarea
\fbox{\begin{overlayarea}{3cm}{2cm}
\fbox{123}
\end{overlayarea}}
%% This looks odd : 456 appears OUTSIDE the overlayarea
\begin{figure}
\fbox{\begin{overlayarea}{3cm}{2cm}
\fbox{456}
\end{overlayarea}}
\end{figure}
\end{frame}
\end{document}
Perhaps I mis-use this environnement ?
Thanks a lot :)
BR
Donut
Quick workaround: warp your subimages in minipages of fixed height:
\documentclass[9pt, aspectratio=43]{beamer}
\begin{document}
\begin{frame}
\begin{figure}
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\hfill
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\hfill
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%%
\end{minipage}%
\hfill
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\hfill
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\hfill
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\hfill
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\end{figure}
\end{frame}
\end{document}

Ordering subfigures in LaTex

I have this code in LaTex:
\begin{figure}[h!]
\centering
\subfigure[]{\includegraphics[width=50mm]{katua.jpg}}
\subfigure[]{\includegraphics[width=60mm]{txakurren_balioak.png}}
\subfigure[]{\includegraphics[width=60mm]{katuen_balioak.png}}}
\label{fig:eb3}
\end{figure}
and I get this:
And I want to put the images in two columns. In the column of the left the image of the cat and in the right the two histograms. How it is possible to do this?
Instead of \centering you could use \hfill to do the centering, see the example below:
\documentclass{report}
\usepackage{graphicx}
\usepackage{subfigure}
\begin{document}
\begin{figure}[h!]
\hfill
\subfigure[]{\includegraphics[width=50mm]{example-image-a}}
\hfill
\subfigure[]{\includegraphics[width=60mm]{example-image-b}}
\hfill
\hfill
\subfigure[]{\includegraphics[width=60mm]{example-image-c}}
\end{figure}
\end{document}

Resources