LATEX skips numbers in numbering when putting several figures in the same figure environment - latex

Here are the package I am using:
\documentclass[twocolumn,showpacs,preprintnumbers,amsmath,amssymb,superscriptaddress]{revtex4}
\usepackage{graphicx}
\usepackage{bm}
\usepackage{subcaption}
\usepackage{SIunits}
\captionsetup{justification=raggedright, singlelinecheck=false}
\bibliographystyle{approve}
In order to put two figures next to each other, using the full width of the page even with the twocolumn option, I use this syntax:
\begin{figure*}
\centering
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics[width=\textwidth]{mfploglog_A.eps}
\end{subfigure}%
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics[width=\textwidth]{mfploglog.eps}
\end{subfigure}
\caption{XXX}\protect\label{Eloglog}
\end{figure*}
The probleme is that using this the numbering is incorrect. For each figure, a number is skipped as if the subfigure environment was counting as one figure. For example if I put just this figure in my code, it is going to be labeled as figure number 2.
Does someone already encountered this kind of problem ?

Don't use the caption package (or subcaption) with revtex4-1. You'll note in the .log that there are compatibility issues between the package and the class. Instead, place the two images side-by-side in the same figure* without using a subfigure environment:
\documentclass[twocolumn,showpacs,preprintnumbers]{revtex4-1}
\usepackage{graphicx}
\begin{document}
\begin{figure*}
\centering
\includegraphics[width=.3333\linewidth]{example-image-a} \qquad
\includegraphics[width=.3333\linewidth]{example-image-b}
\caption{XXX}
\end{figure*}
\end{document}
If you wish to add captions to the sub-figures, set the construction inside a tabular and enumerate them manually:
\documentclass[twocolumn,showpacs,preprintnumbers]{revtex4-1}
\usepackage{graphicx}
\begin{document}
\begin{figure*}
\centering
\begin{tabular}{c #{\qquad} c }
\includegraphics[width=.3333\linewidth]{example-image-a} &
\includegraphics[width=.3333\linewidth]{example-image-b} \\
\small (a) Left & \small (b) Right
\end{tabular}
\caption{XXX}
\end{figure*}
\end{document}

Related

How can I print the presentation made in Beamer without white bars?

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)

Caption for figure into a table

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}

Refering with type and not only number

when I want to refer to for example an equation, I do the following:
\begin{align}
R= \frac{c * \Delta T}{2}
\label{eqn:Range}
\end{align}
Now I want to refer to \ref{eqn:Range}.
Then the output is the following:
Now I want to refer to 3.4.
I would like that the output is already:
Now I want to refer to equation 3.4.
Without me having to write equation manually.
The same goes also for tables and figures.
Especially for figures, I would like to know if there are more possibilities to display the reference.
For example with the following:
\begin{figure}[t]
\centering
\includegraphics[width=0.7\textwidth]{Example}
\caption{Example caption}
\label{fig:ExampleRef}
\end{figure}{}
I would like to be able to get also the caption displayed: Figure 1.1: Example caption.
Thank you for your help.
This sounds like a job for the cleveref package:
\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[noabbrev]{cleveref}
\begin{document}
\begin{align}
R= \frac{c * \Delta T}{2}
\label{eqn:Range}
\end{align}
Now I want to refer to \cref{eqn:Range}.
\begin{figure}[t]
\centering
\includegraphics[width=0.7\textwidth]{example-image-duck}
\caption{Example caption}
\label{fig:ExampleRef}
\end{figure}
\cref{fig:ExampleRef}
\end{document}

Additional dot in section/subsection not being displayed in table of content

I would like to have a table of content with numbering identical to the ones in text. So, in text each section/subsection/subsubsection is numerated as '1.' or '1.1.' or '1.1.1.'. However my table of content is not updating it, so it shows '1' or '1.1'.
I was following answer to this topic: https://superuser.com/questions/811779/how-to-add-a-dot-for-section-subsection-numbering-in-tex
So I am using 'secdot' package. I have tried using
\renewcommand{\thechapter}{\arabic{chapter}.}
\renewcommand{\thesection}{\thechapter\arabic{section}.}
but I keep getting '\the chapter undefined', 'No counter chapter defined' or 'Missing number, treated as zero' errors.
I would appreciate any tips on what's wrong.
EDIT:
\documentclass[11pt, a4paper, twoside]{article}
\usepackage{listings, lstautogobble}
\usepackage{ragged2e}
\usepackage{times}
\usepackage{secdot}
\sectiondot{subsection}
\usepackage{listings}
\usepackage[toc,page]{appendix}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\geometry{a4paper,
left=30mm,
top=25mm,
bottom=25mm,
right=20mm
}
\sectiondot{subsection}
\makenomenclature
\setlength{\parindent}{0.5 cm}
\renewcommand{\baselinestretch}{1.15}
\pagenumbering{roman}
\begin{document}
\setboolean{#twoside}{false}
\begin{figure}[H]
\begin{center}
\includegraphics[width=14cm,height=15cm,keepaspectratio]{./thesis- frontpagedesign}
\end{center}
\end{figure}
\begin{center}
\tableofcontents
\end{center}
\begin{center}
\listoffigures
\end{center}
\section{Introduction}
%sometext
\makeatletter
\def\#seccntformat#1{%
\expandafter\ifx\csname c##1\endcsname\c#section\else
\csname the#1\endcsname\quad
\fi}
\makeatother
\end{document}
Your current setup is confusing. For example,
\makeatletter
\def\#seccntformat#1{%
\expandafter\ifx\csname c##1\endcsname\c#section\else
\csname the#1\endcsname\quad
\fi}
\makeatother
removes the setting of any \section number. And mixing this with the use of secdot seems problematic.
The easiest way to achieve dots after sectional unit numbers within your text as well as the ToC is to adjust the representation of the respective counters:
\documentclass{article}
\renewcommand{\thesection}{\arabic{section}.}
\renewcommand{\thesubsection}{\thesection\arabic{subsection}.}
\renewcommand{\thesubsubsection}{\thesubsection\arabic{subsubsection}.}
\begin{document}
\tableofcontents
\section{Introduction}
\end{document}
This solution is sufficient, but will also affect \references. For example \ref{sec:introduction} would return 1. which may look odd in the middle of a sentence: ... from section~\ref{sec:introduction} we can see ....
If you don't want periods ending your \references, you can use
\usepackage{secdot}% Adds . after sectional unit numbers
\usepackage{etoolbox}
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\numberline}{\hfil}{.\hfil}{}{}
You're already familiar with what secdot does. The patch to \numberline is thanks to etoolbox which changes the default definition
\def\numberline#1{\hb#xt#\#tempdima{#1\hfil}}
into
\def\numberline#1{\hb#xt#\#tempdima{#1.\hfil}}
effectively inserting an ending-period as part of the number that is printed within the ToC. Note that this will also affect how figures/tables are displayed within the LoF/LoT. However, one can change that using scoping:
\begingroup
% The following patch will only affect entries in the ToC
\patchcmd{\numberline}{\hfil}{.\hfil}{}{}
\tableofcontents
\endgroup
\listoffigures
\listoftables

Rotate a page 180 degrees in LaTeX

How can I rotate a page 180 degrees in LaTeX?
\usepackage{lscape}
\begin{landscape}
Some text
\end{landscape}
Or for the whole document:
\documentclass[landscape]{article}
Edit: This would of course only rotate the page by 90°... Sorry. ;)
Have you tried the rotating package?
See http://en.wikibooks.org/wiki/LaTeX/Packages/Rotating
This would rotate the content you put between begin and end. Do you need a designated page to be rotated you can achieve it using \newpage and \clearpage.:
To answer your question in the comments, I don't know how to achieve this within one single environment if you are going to use different types of content (text, images...) within the turn environment. That depends a lot on what you exactly want to achieve.
\documentclass{article}
\usepackage{rotating}
\title{Test document}
\author{Wesho}
\date{18/06/2009}
\begin{document}
\maketitle
\newpage
\begin{rotate}{180}
\includegraphics{graphic.pdf}
\end{rotate}
\clearpage
\end{document}
It depends on the task, but \rotatebox{180} together with \minipage can do the job:
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{rotating}
\usepackage{lipsum}
\begin{document}
\lipsum[1-3]
\newpage
\noindent\rotatebox{180}{\noindent\begin{minipage}{\textwidth}
\lipsum[1]
\begin{center}\includegraphics{image01.jpg}\end{center}
\lipsum[2]
\begin{center}
\begin{tabular}{cc}
\hline
1 & 2 \\
3 & 4 \\
\hline
\end{tabular}
\end{center}
\lipsum[3]
\end{minipage}}
\clearpage
\lipsum[1-3]
\end{document}

Resources