I've exported 3 figures from R studio (in .png). How can I vertically align them on one page using latex?
That's my attempt
\documentclass[11pt,fleqn,a4paper]{article}
\usepackage{graphicx}
\usepackage[caption=false]{subfig}
\begin{document}
\begin{figure}[htp]
\subfloat[Germany, sectors C26 to C30]{%
\includegraphics[clip,width=0.5\columnwidth]{Images/deu.png}%
}
\subfloat[Italy, sectors C29-C30]{%
\includegraphics[clip,width=0.5\columnwidth]{Images/ITA.png}%
}
\subfloat[United States, sectors C29-C30]{%
\includegraphics[clip,width=0.5\columnwidth]{Images/USA.png}%
}
\caption{Offshoring level. \\Source: Elaborated data from WIOT and SEA tables (2016).}
\end{figure}
\end{document}
To get your image one below each other, insert an empty line between each \subfloat. This empty line will insert a new paragraph:
\documentclass[11pt,fleqn,a4paper]{article}
\usepackage{graphicx}
\usepackage[caption=false]{subfig}
\begin{document}
\begin{figure}[htp]
\centering
\subfloat[Germany, sectors C26 to C30]{%
\includegraphics[clip,width=0.5\columnwidth]{example-image-duck}%
}
\subfloat[Italy, sectors C29-C30]{%
\includegraphics[clip,width=0.5\columnwidth]{example-image-duck}%
}
\subfloat[United States, sectors C29-C30]{%
\includegraphics[clip,width=0.5\columnwidth]{example-image-duck}%
}
\caption{Offshoring level. \\Source: Elaborated data from WIOT and SEA tables (2016).}
\end{figure}
\end{document}
Related
I have a latex document in which I have included two images side by side within an enumerate function. The caption for those individual figures is aligned to the figure itself, but the overall Figure title is not aligned with the enumerate function instead it is aligned with the rest of the document. It could probably be a quick fix, but I am unable to find it. Can anybody help, please?
\begin{enumerate}
\item Consider the two figures given below,
\begin{figure}[h]
\centering
\begin{minipage}{0.4\linewidth}
\centering
\subfloat[\centering Figure 1 title.]
{
{
\includegraphics[width=1\linewidth]{Figures/Figure_1.png}
}
\label{Figure_1}
}
\end{minipage}
\begin{minipage}{0.4\linewidth}
\centering
\subfloat[\centering Figure 2 title.]
{
{
\includegraphics[width=1\linewidth]{Figures/Figure_.png}
}
\label{fig:Figure_2}
}
\end{minipage}
\caption{Common title for figure 1 and figure.}%
\label{fig:fig:power_response}
\end{figure}
\end{enumerate}
How can I print on Epson L4160, or any other printer the presentation made in Latex connected with Beamer, having scale of frame 16:9? My trouble is strange, because I don't want to have a white bars... But, what I have discovered, on the preview in Adobe Reader, in full screen preview it looks very good...
Snapshot of printing:
Snapshot of fullscreen presentation:
And code: (due to many lines, I can paste it on other page if it is necessary)
\documentclass[polish,aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{polski}
\usepackage{ragged2e} %justify
\usepackage[inline]{enumitem}
\usepackage{multicol}
\usepackage{gensymb} %degree
\usepackage{colortbl} %color of row
\usepackage{cancel} %fraction cancel line
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{url} %bibliography
\usepackage{amsmath}
\usepackage{subcaption}
\usepackage{scalerel}
\DeclareMathOperator*{\Bigcdot}{\scalerel*{\cdot}{\bigodot}}
\usetikzlibrary{positioning, calc}
\usetheme{Warsaw}
\definecolor{myAmber}{rgb}{1.0, 0.49, 0.0} %#FF7E00
\usecolortheme[named=myAmber]{structure}
\setlength{\parindent}{0pt}
\title{Wprowadzenie do matematyki}
\subtitle{2. Koniunkcja i alternatywa w zdaniach.}
\author{Konstanty Dmochowski}
%\date{}
\expandafter\def\expandafter\insertshorttitle\expandafter{%
\insertshorttitle\hfill \hspace*{3.85cm}%
\insertframenumber\,/\,\inserttotalframenumber}
\makeatletter
\long\def\beamer##ssection*#1{\beamer#section[]{}}
\makeatother %remove section both from header and outline in beamer
\newcommand{\lcancel}[2]{\cancel{#1}_{#2}}
\newcommand{\ucancel}[2]{\cancel{#1}^{#2}}
\newcommand*{\rechterWinkel}[3]{% #1 = point, #2 = start angle, #3 = radius
\draw[shift={(#2:#3)}] (#1) arc[start angle=#2, delta angle=90, radius = #3];
\fill[shift={(#2+45:#3/2)}] (#1) circle[radius=2.5\pgflinewidth];
}
%\special{pdf:encrypt ownerpw (prezentacjaPL2020) userpw (prezentacja2020) length 128 perm 2052}
\AtBeginSection[]
{
\begin{frame}
\frametitle{Plan pracy}
\tableofcontents[currentsection]
\end{frame}
}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle{Plan pracy}
\tableofcontents
\end{frame}
\section{Wprowadzenie}
\begin{frame}{O czym będziemy mówili?}
\begin{figure}[h!]
\begin{center}
\includegraphics[scale=0.2]{idea-3383766_1280.jpg}
\end{center}
\caption{Jak sądzicie?}
\end{figure}
\end{frame}
\begin{frame}{Przypomnienie}
\justify
Do tej pory mówiliśmy wyłącznie o \textbf{zdaniach logicznych} i ich \textbf{zaprzeczeniach}.
\\[0.25cm]
\pause
\textbf{Przykład:} \textit{Kwadrat ma nieskończenie wiele osi symetrii.}
\pause
\\[0.25cm] Są to tak zwane zdania proste - wyrażają one bowiem jedną myśl, składają się z jednego orzeczenia.
\pause \\[0.25cm] \textcolor{myAmber}{Pytanie:} Co się dzieje, gdy zdanie jest bardziej rozbudowane, skomplikowane? W jaki sposób wówczas z nim poradzić?
\end{frame}
\subsection{Zdania złożone}
\begin{frame}{Zdania złożone}
\justifying
Okazuje się, że zdania tej postaci:
\\[0.25cm] \pause \textit{Wojtek poszedł do kina lub zjawił się na stadionie.}
\\[0.25cm] \pause \textit{Eliza narysowała dom i wymieniła cieńkopis.}
\pause \\[0.25cm] prowadzą nas do nowego pojęcia: \textbf{zdania złożonego}. Powiedzmy coś o nich.
\end{frame}
To get more or less the same aspect ration than a A4 paper, you could modify the page geometry like this:
\documentclass[polish,aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{polski}
\usepackage{ragged2e} %justify
%\usepackage[inline]{enumitem}
%\usepackage{multicol}
\usepackage{gensymb} %degree
%\usepackage{colortbl} %color of row
\usepackage{cancel} %fraction cancel line
%\usepackage{graphicx}
\usepackage{tikz}
%\usepackage{url} %bibliography
%\usepackage{amsmath}
\usepackage{subcaption}
\usepackage{scalerel}
\usetheme{Warsaw}
\definecolor{myAmber}{rgb}{1.0, 0.49, 0.0} %#FF7E00
\usecolortheme[named=myAmber]{structure}
\title{Wprowadzenie do matematyki}
\subtitle{2. Koniunkcja i alternatywa w zdaniach.}
\author{Konstanty Dmochowski}
\makeatletter
\setlength\beamer#paperwidth{16.00cm} \setlength\beamer#paperheight{11.31cm}
\geometry{%
papersize={\beamer#paperwidth,\beamer#paperheight},
hmargin=2cm,%
vmargin=0cm,%
head=1cm,% might be changed later
headsep=0pt,%
foot=1cm% might be changed later
}
\makeatother
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\end{document}
Some other comments about your code:
don't use enumitem with beamer
beamer has its own column mechanism, multicol is not necessary
if you need something from the colortbl package, use the xcolor={table} documentclass option instead of loading the package
you don't need graphicx
you also don't need url - beamer loads hyperref
no need for amsmath either, beamer already loads this
using floating specifier such as [h!] in a documentclass without floating mechanism makes no sense
don't use \begin{center}...\end{center} within your figures. This adds additional vertical space and is also unnecessary because figures are centred by default
don't abuse \\ for line breaks. Leave an empty line instead
instead of manually numbering things like Definicja 1., use an appropriate environment like definition, these can be made to number things automatically
Just give the filename of images without file type. Latex will automatically choose the best suited type in case you have the image in different formats
have a look at the booktabs package. Data prison style tables are really ugly
it should be \justifying and not \justify (the later kinda works by accidents, but causes many strange problems because it actually is an environment and not a macro)
I've been trying all day to put captions to some figures I arranged into a table. First I used table but it was not succesful, and then I found this post https://tex.stackexchange.com/questions/383254/placing-figures-inside-table-with-captions-for-each, where tabularx was used. I got good results with figures into the table, but I failed when I try to add captions using \captionof. Here's my code
\documentclass[aip,amsmath,amssymb,reprint]{revtex4-1}
\usepackage{graphicx}
\usepackage{dcolumn}
\usepackage{bm}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage{float}
\usepackage{xcolor}
\usepackage{multirow}
\usepackage{float}
\usepackage{tabularx}
\usepackage{capt-of}
\usepackage{tabu}
\begin{document}
\begin{table}
\begin{tabularx}{500pt}{ccc}
\includegraphics[width=0.48\textwidth]{16b_red_cabezas_normalizadas.png} %\captionof{figure}
%{\label{fig:red_all} Functional networks for frequency bands. (a) $\theta$, (b) $\alpha$, (c)
%$\beta$, (d) $\gamma$. Node sizes are proportional to $\langle c_w \rangle$.}
&\hspace{0.5cm}
&\includegraphics[width=0.45\textwidth]{2_biplot_alpha.png} %\caption{\label{fig:biplot} Factorial
%plane for dynamics and structure. Frontal lobe (orange), occipital (green), parietal (cyan), temporal
%(purple).}
\end{tabularx}
\end{table}
\end{document}
This code works perfectly, but when I delete % from the code I get some errors like this:
! Missing \endgroup inserted.<inserted text>\endgroup \end{tabularx}
! Missing \cr inserted.<inserted text>\cr \end{tabularx}
! Missing } inserted.<inserted text>} \end{tabularx}
I don't know what I am doing wrong. Thanks for your help.
The source of your problem is that \captionof needs to make a linebreak after the image and your c type columns don't allow that. You can solve this by using a column type that allows line breaks, e.g. p columns of fixed width or, as you are already using a tabularx, a flexible X column.
Besides this, your table with 500pt is much too wide to fit into onto the paper, let alone into a single column. To get a bit more room, you can use a figure* environment instead that will span over both columns (or table*, but as you are showing figures, this seems not appropriate).
\documentclass[aip,amsmath,amssymb,reprint]{revtex4-1}
\usepackage{graphicx}
\usepackage{dcolumn}
\usepackage{bm}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage{float}
\usepackage{xcolor}
\usepackage{multirow}
\usepackage{float}
\usepackage{tabularx}
\usepackage{capt-of}
\usepackage{tabu}
\begin{document}
\begin{figure*}
\begin{tabularx}{\textwidth}{XcX}
\includegraphics[width=\linewidth]{example-image-duck} \captionof{figure}{\label{fig:red_all} Functional networks for frequency bands. (a) $\theta$, (b) $\alpha$, (c)
$\beta$, (d) $\gamma$. Node sizes are proportional to $\langle c_w \rangle$.}
&\hspace{0.5cm}
&\includegraphics[width=\linewidth]{example-image-duck} \caption{\label{fig:biplot} Factorial
plane for dynamics and structure. Frontal lobe (orange), occipital (green), parietal (cyan), temporal
(purple).}
\end{tabularx}
\end{figure*}
\end{document}
I put two image.png in my latex documnet using \includegraphics. Now I want to joint two points of these images together by a line. I wonder if it is possible to do so in Latex?
First: no it is impossible: as Gyro Gearloose had said LaTeX has no idea about the content of your png.
Second: sure you can ;-) A little cheat with tikz. You can connect two arbitrary points with an arrow (or a line).
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{tikzmark} % arrows in tex
\usetikzlibrary{arrows} % arrows in tex
\usetikzlibrary{calc} % (node)+(3cm,2cm)
\tikzstyle{every picture}+=[remember picture]
\begin{document}
\lipsum[1]
\includegraphics[width=0.2\textwidth]{solidtex.png}
{\tikz\node[coordinate](start1){};}
\lipsum[2]
{\tikz\node[coordinate](end1){};}
\includegraphics[width=0.2\textwidth]{solidtex.png}
\lipsum[3]
\begin{tikzpicture}[overlay, remember picture, -latex, color=blue!15!red, yshift=1ex, shorten >=1pt, shorten <=1pt, line width=0.1cm]
\path[->] (start1) edge [out=150, in=240] (end1);
\end{tikzpicture}
\end{document}
But it still connects the corners of the images. To connect points inside the pictures, you have to modify the coordinates manually e.g.:
\path[->] (start1) edge [out=150, in=240] ($(end1)+(2cm,2cm)$);
or pt, ex, mm ect...
If you want line without arrow head, use:
\path[-] (start1) edge [out=150, in=240] (end1);
Note that like labeling and referring figures, you have to run latex (or pdflatex or ...) twice.
I am trying to add a simple figure into my latex code .I have this code :
\begin{figure}[H]
\resizebox{40pt}{!}{
\centering \includegraphics{FigureStereo.jpg}}
\caption{Epipolar Geometry}
\label{fig:cclogo}
\end{figure}
with this however the text comes on top of the image and also image is not centered .What am I doing wrong?Hopefully this is not a repeated question coz I did do a quick check on related posts.
Edited
Here is the preamble
\documentclass[draftthesis,tocnosub,noragright,centerchapter,12pt,]{uiucecethesis09}
\makeatletter
\usepackage{setspace}
\usepackage{epsfig} % for figures
\usepackage{graphicx} % another package that works for figures
%\usepackage{subfigure} % for subfigures
\usepackage{amsmath} % for math spacing
%\usepackage{amssymb} % for math spacing
%\usepackage{url} % Hyphenation of URLs.
\usepackage{lscape} % Useful for wide tables or figures.
\usepackage[justification=raggedright]{caption} % makes captions ragged right - thanks to Bryce Lobdell
\usepackage{float}
\usepackage{wrapfig}
% Uncomment the appropriate one of the following four lines:
\msthesis
%\phdthesis
%\otherdoctorate[abbrev]{Title of Degree}
%\othermasters[abbrev]{Title of Degree}
\title{}
\author{}
\department{}
\degreeyear{}
% Advisor name is required for
% - doctoral students for the ProQuest abstract
% - master's students who do not have a master's committee
\advisor{}
% Uncomment the \committee command for
% - all doctoral students
% - master's students who have a master's committee
%\committee{Professor Firstname Lastname, Chair\\
% Professor Firstname Lastname} % etc.
You can use a center environment for centering, wrapping it around both the image box and the caption:
\begin{figure}[h!]
\begin{center}
\resizebox{40pt}{!}{\includegraphics{FigureStereo.jpg}}
\caption{Epipolar Geometry}
\label{fig:cclogo}
\end{center}
\end{figure}
Note, though, that LaTeX can sometimes be pretty stubborn about how it lays out pages where floating elements are concerned. The h option is more of a guideline than a guarantee. In some cases you might be better off not using a floating figure environment and instead inserting the graphics and text directly.
Also, you're better off asking this sort of question over at the TeX StackExchange site.
You probably just want something like
\begin{figure}[t]
\centerline{\includegraphics[width=\columnwidth]{figs/foo}}
\caption{Caption Goes Here}
\label{fig:cclogo}
\end{figure}