Custom titlepage in LaTeX - latex

I am trying to create a custom title page in LaTeX according to my organization's template (in Word).
I managed to get close to it with the following code:
\documentclass{report}
\usepackage[a4paper,twoside,bindingoffset=0cm,nomarginpar,includeheadfoot,headheight=1.25cm,headsep=0cm,top=1cm,bottom=1.8cm,inner=1.75cm,outer=1.75cm,showframe]{geometry}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{calc}
\usepackage{graphicx}
\usepackage{tabularx}
\definecolor{greenBE}{RGB}{141,182,60}
\definecolor{blueBE}{RGB}{0,111,144}
\title{La qualité de l'air en Région de Bruxelles-Capitale}
\newcommand{\subtitle}{Rapport annuel 2019}
\author{}
\usepackage{lipsum}
\begin{document}
\makeatletter
\begin{titlepage}
\thispagestyle{empty}
\newlength{\rulewidth}\setlength{\rulewidth}{3cm}%
\newlength{\logowidth}\setlength{\logowidth}{2.5cm}%
\newlength{\logoheight}\setlength{\logoheight}{\logowidth*\ratio{592pt}{1538pt}}% image size : 1538 x 592
\begingroup
\setlength{\tabcolsep}{0pt}
\renewcommand{\arraystretch}{0}
\noindent%
\begin{tabularx}{\textwidth}{p{\rulewidth}c>{\centering}X}
\cellcolor{blueBE}&\includegraphics[width=\logowidth]{ILLU_FR_LogoBE.jpg}&\cellcolor{greenBE}\color{white}{RAPPORT TECHNIQUE}
\end{tabularx}
\endgroup
\vspace*{3cm}
\color{blueBE}
\raggedleft\MakeUppercase{\Large\textbf{\#title}}\\
~\\
\raggedleft\large\textbf{\subtitle}
\vfill
\raggedleft\MakeUppercase{\Large\#date}\\
\vspace*{4cm}
\noindent%
\color{blueBE}{\rule{\textwidth}{\logoheight}}
\end{titlepage}
\makeatother
\restoregeometry
\tableofcontents
\chapter{Prerequisites}\label{prerequisites}
\lipsum
\end{document}
and the image logo ILLU_FR_LogoBE.jpg
However, as you can notice below, the text "RAPPORT TECHNIQUE" on top of the first page is enlarging the height of the row. Instead, I would like to center it vertically in the middle of the logo.
What am I doing wrong ?
Many thanks,
Alessandro

You could use \usepackage[export]{adjustbox} and then play around with different valign options for the graphic.
\documentclass{report}
\usepackage[a4paper,twoside,bindingoffset=0cm,nomarginpar,includeheadfoot,headheight=1.25cm,headsep=0cm,top=1cm,bottom=1.8cm,inner=1.75cm,outer=1.75cm,showframe]{geometry}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{calc}
\usepackage{graphicx}
\usepackage{tabularx}
\definecolor{greenBE}{RGB}{141,182,60}
\definecolor{blueBE}{RGB}{0,111,144}
\title{La qualité de l'air en Région de Bruxelles-Capitale}
\newcommand{\subtitle}{Rapport annuel 2019}
\author{}
\usepackage{lipsum}
\usepackage[export]{adjustbox}
\begin{document}
\makeatletter
\begin{titlepage}
\thispagestyle{empty}
\newlength{\rulewidth}\setlength{\rulewidth}{3cm}%
\newlength{\logowidth}\setlength{\logowidth}{2.5cm}%
\newlength{\logoheight}\setlength{\logoheight}{\logowidth*\ratio{592pt}{1538pt}}% image size : 1538 x 592
\begingroup
\setlength{\tabcolsep}{0pt}
%\renewcommand{\arraystretch}{0}
\noindent%
\begin{tabularx}{\textwidth}{p{\rulewidth}c>{\centering}X}
\cellcolor{blueBE}&\includegraphics[width=\logowidth,valign=t]{ILLU_FR_LogoBE.jpg}&\cellcolor{greenBE}\color{white}RAPPORT TECHNIQUE
\end{tabularx}%
\endgroup
\vspace*{3cm}
\color{blueBE}
\raggedleft\MakeUppercase{\Large\textbf{\#title}}\\
~\\
\raggedleft\large\textbf{\subtitle}
\vfill
\raggedleft\MakeUppercase{\Large\#date}\\
\vspace*{4cm}
\noindent%
\color{blueBE}{\rule{\textwidth}{\logoheight}}
\end{titlepage}
\makeatother
\restoregeometry
\tableofcontents
\chapter{Prerequisites}\label{prerequisites}
\lipsum
\end{document}

Related

How could I list the subsections in beamer (table of contens)?

Hello I trying to list the subsections in table of contents (beamer), but I can't get the result ? Anyone knows how to do it ?
My code (I am using the \usetheme{CambridgeUS}):
\documentclass[handout,10pt,aspectratio=169]{beamer}
\usepackage[spanish]{babel}
\usepackage{multirow,rotating}
\usepackage{color}
\usepackage{hyperref}
\usepackage{tikz-cd}
\usepackage{array}
\usepackage{siunitx}
\usepackage{mathtools,nccmath}%
\usepackage{etoolbox, xparse}
\usecolortheme{dolphin}
\usepackage{lipsum}
\usepackage{natbib}
\usepackage{hyperref}
\usepackage{calc}
\usepackage{environ}
\usepackage{courier}
\usepackage{tcolorbox}
\usetheme{CambridgeUS}
\title[]{\textcolor{black}{\vskip 1.5cm\textbf {Title}}}
\begin{document}
\begin{frame}
\maketitle
\end{frame}
\begin{frame}
\frametitle{Contenido}
\tableofcontents
\end{frame}
\section{Introducción}
\begin{frame}{Introducción}
\subsection{sismos lentos}
\end{frame}
\end{document}
Never use sectioning commands like \section or \subsection within a frame. They must be used outside the frame.
Apart from this problem, you can use https://stackoverflow.com/a/74094309/2777074 to get squares in the toc:
\documentclass[handout,10pt,aspectratio=169]{beamer}
\usepackage[spanish]{babel}
\usepackage{multirow,rotating}
%\usepackage{color}
%\usepackage{hyperref}
\usepackage{tikz-cd}
\usepackage{array}
\usepackage{siunitx}
\usepackage{mathtools,nccmath}%
\usepackage{
%etoolbox,
xparse}
\usecolortheme{dolphin}
\usepackage{lipsum}
\usepackage{natbib}
%\usepackage{hyperref}
\usepackage{calc}
\usepackage{environ}
\usepackage{courier}
\usepackage{tcolorbox}
\usetheme{CambridgeUS}
\title[]{\textcolor{black}{\vskip 1.5cm\textbf {Title}}}
\setbeamertemplate{sections/subsections in toc}[square]
\begin{document}
\begin{frame}
\maketitle
\end{frame}
\begin{frame}
\frametitle{Contenido}
\tableofcontents
\end{frame}
\section{Introduccion}
\subsection{sismos lentos}
\begin{frame}{Introduccion}
\end{frame}
\end{document}

Removing spaces between chapter LoF in table of contents

I'm trying to remove the space in LoF between different chapters. i have tried different solutions(patching it as well) but it is not working. I have attached the codes below for your reference. Any help or pointers to resolve it would be highly appreciated.
Edit: Link to a minimal working project file depicting the error.
Working Example
\documentclass[twoside, 12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{pdfpages}
%package for higlighting text
\usepackage{color,soul}
%packages for multicol glossary, bibliography and list
\usepackage[section,numberedsection=autolabel, acronym]{glossaries}
\usepackage{setspace}
\usepackage{enumitem}
\usepackage[style=ieee]{biblatex}
\usepackage{glossary-mcols}
\usepackage{multicol}
%package for comments
\usepackage{verbatim}
%%Random text
\usepackage{lipsum}
%packages for fancy headers
\usepackage{blindtext}
\usepackage{fancyhdr}
\usepackage{tikz}
%package for subfigures
\usepackage{subfigure}
\makeglossaries
% Use package below to change margins and graphics
\usepackage{graphicx}
\usepackage[a4paper,top=25mm,bottom=25mm,left=25mm,right=25mm]{geometry}
% text color package
\usepackage{xcolor}
% use to customize chapter headings of toc lof lot
\usepackage{tocloft}
\renewcommand{\cfttoctitlefont}{\hspace*{\fill}\Large\bfseries}
\renewcommand{\cftaftertoctitle}{\hspace*{\fill}}
\renewcommand{\cftlottitlefont}{\hspace*{\fill}\Large\bfseries}
\renewcommand{\cftafterlottitle}{\hspace*{\fill}}
\renewcommand{\cftloftitlefont}{\hspace*{\fill}\Large\bfseries}
\renewcommand{\cftafterloftitle}{\hspace*{\fill}}
\usepackage{sectsty}
\chapternumberfont{\Large}
\chaptertitlefont{\Large}
\usepackage{hyperref}
%for table
\usepackage{booktabs}
%maths Package
\usepackage{amsmath}
%minted package
\usepackage[]{minted}
\usepackage{fancyvrb}
%for greek words
\usepackage[utf8]{inputenc}
\usepackage[greek,english]{babel}
\usepackage{lmodern}
\usemintedstyle{vs}
\setminted{bgcolor=myGray,
breaklines,
mathescape,
linenos,
numbersep=5pt,
frame=single,
numbersep=5pt,
xleftmargin=0pt,
breaksymbolleft=\raisebox{0.8ex}{
\small\reflectbox{\carriagereturn}},
breaksymbolindentleft=0pt,
breaksymbolsepleft=0pt,
breaksymbolindentright=0pt,
breaksymbolsepright=0pt
}
%for code listing
\usepackage{xcolor}
\usepackage{listings}
\definecolor{myGray}{RGB}{245, 239, 239}
\definecolor{maroon}{RGB}{128,0,0}
\definecolor{forestGreen}{RGB}{1,68,33}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{myGray},
commentstyle=\color{forestGreen},
keywordstyle=\color{blue},
numberstyle=\tiny\color{gray},
stringstyle=\color{maroon},
basicstyle=\ttfamily\small,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
frame=single
}
\lstset{style=mystyle}
%Patch to remove the space in LoF, LoT, LoC per chapter basis
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\#chapter}{\addtocontents{lof}{\protect\addvspace{10\p#}}}{}{}{}% LoF
\patchcmd{\#chapter}{\addtocontents{lot}{\protect\addvspace{10\p#}}}{}{}{}% LoT
\makeatother
%for custom caption
\usepackage{caption}
% document begins here
\begin{document}
%Footer and header fancy - chapter x. ChapterName format
\fancyhead{}
\fancyhead[RO,LE]{\leftmark}
\fancyfoot{}
\fancyfoot[CE,CO]{\thepage}
\newpage
\phantomsection
\tableofcontents
\addcontentsline{toc}{chapter}{Table of Contents}
\newpage
\listoftables
\phantomsection
\addcontentsline{toc}{chapter}{\listtablename}
\newpage
\listoffigures
\phantomsection
\addcontentsline{toc}{chapter}{\listfigurename}
\newpage
\renewcommand{\lstlistingname}{Code}
\renewcommand{\lstlistlistingname}{List of \lstlistingname s}
\lstlistoflistings
\phantomsection
\addcontentsline{toc}{chapter}{\lstlistlistingname}
%CHAPTERS BEGIN
\pagenumbering{arabic}
\newpage
\input{Chapters/Intro}
\input{Chapters/Results}
\newpage
%%APPENDIX BEGINS
\fancyhead{}
\fancyfoot{}
\end{document}
Please find below the code for respective
The below figures are part of sample Intro file.
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{<someImage>}
\caption{Software Development Lifecycle}
\label{fig:swCycle}
\end{figure}
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{<someImage>}
\caption{Software Development Lifecycle2}
\label{fig:swCycle2}
\end{figure}
Results File
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{<someImage>}
\caption{Software Development Lifecycle3}
\label{fig:swCycle3}
\end{figure}
You could remove the spaces between the list entries of different chapters if you make the patches before you load hyperref:
\documentclass[twoside, 12pt]{report}
% use to customize chapter headings of toc lof lot
\usepackage{tocloft}
\renewcommand{\cfttoctitlefont}{\hspace*{\fill}\Large\bfseries}
\renewcommand{\cftaftertoctitle}{\hspace*{\fill}}
\renewcommand{\cftlottitlefont}{\hspace*{\fill}\Large\bfseries}
\renewcommand{\cftafterlottitle}{\hspace*{\fill}}
\renewcommand{\cftloftitlefont}{\hspace*{\fill}\Large\bfseries}
\renewcommand{\cftafterloftitle}{\hspace*{\fill}}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\#chapter}{\addtocontents{lof}{\protect\addvspace{10\p#}}}{}{}{}
\patchcmd{\#chapter}{\addtocontents{lot}{\protect\addvspace{10\p#}}}{}{}{}
\makeatother
% load hyperref after these patches
\usepackage{hyperref}
\begin{document}
\listoffigures
\chapter{test}
\begin{figure}[htbp]
\caption{heading}
\end{figure}
\chapter{test}
\begin{figure}[htbp]
\caption{heading}
\end{figure}
\end{document}

Align Sub Figures in latex (IEEE paper format)

I want to align three figures in one row. I used the following latex code but got this output. What to change in this code to get these figures in one row? Thank you in advance.
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\begin{document}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{algorithm}
\usepackage{amsmath,amssymb}
\usepackage{subcaption}
\usepackage{url}
\usepackage{hyperref}
\begin{figure*}[!h]
\centering
\begin{subfigure}[t]{0.5\textwidth}
\centering
\includegraphics[scale=0.5]{Paper/results.PNG}
\caption{Fig_1} \label{fig1}
\end{subfigure}\hfill
\begin{subfigure}[t]{0.5\textwidth}
\centering
\includegraphics[scale=0.5]{Paper/results.PNG}
\caption{Fig_2} \label{fig2}
\end{subfigure}\hfill
\begin{subfigure}[t]{0.5\textwidth}
\centering
\includegraphics[scale=0.5]{Paper/results.PNG}
\caption{Fig_3} \label{fig3}
\end{subfigure}
\caption{Figures}
\label{fig:my_label}
\end{figure*}
\end{document}
This is a two-column paper
Output I get from the above code
The sum of 3 times .5\textwidth is much bigger than the available space on one line. If you want to fit all three images in a single line, make them smaller:
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{algorithm}
\usepackage{amsmath,amssymb}
\usepackage{subcaption}
\usepackage{url}
\usepackage{hyperref}
\begin{document}
\begin{figure*}[!h]
\centering
\begin{subfigure}[t]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-duck}
\caption{Fig1} \label{fig1}
\end{subfigure}\hfill
\begin{subfigure}[t]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-duck}
\caption{Fig2} \label{fig2}
\end{subfigure}\hfill
\begin{subfigure}[t]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-duck}
\caption{Fig3} \label{fig3}
\end{subfigure}
\caption{Figures}
\label{fig:mylabel}
\end{figure*}
\end{document}

How to put and align figures in multicols environment

I write an article, which is divided into two columns separated by a line. I use multicol package. I want to insert figures and align them to the top or to the down of the page in multicols environment. Figures can be inserted by the use of minipage environment by i don't know how to align them up or down. figure environment does not work in multicols environment.
\documentclass{article}
\usepackage{geometry}
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{caption}
\geometry{margin=0.75in}
\begin{document}
\begin{multicols}{2}
\lipsum[1-3]
\vfill
\begin{minipage}{\linewidth}
\centering
\includegraphics[width=\linewidth]{beta_glucan.png}
\captionof{figure}{Figure caption}
\end{minipage}
\lipsum[1-3]
\end{multicols}
\end{document}
Any help will be appreciated cause I have been loosing time at it since friday.
Non-multicols solution:
\documentclass[twocolumn]{article}
\usepackage{geometry}
%\usepackage{multicol}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{caption}
\usepackage{float}
\geometry{margin=0.75in}
\setlength{\columnseprule}{0.4pt}
\begin{document}
% \begin{multicols}{2}
\lipsum[1-3]
\begin{figure}[tb]
\centering
\includegraphics[width=\linewidth]{example-image}
\caption{Figure caption}
\end{figure}
\lipsum[1-3]
% \end{multicols}
\end{document}

LaTeX: Indent subcaption in figure environment

See this MWE:
% !TeX spellcheck = en_US
\documentclass[12pt]{article}
\usepackage[onehalfspacing]{setspace}
\usepackage[a4paper, margin=2.5cm]{geometry}
\usepackage{mathptmx}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[hang]{caption}
\usepackage{subcaption}
\usepackage[bottom]{footmisc}
\usepackage{dcolumn} %makes r output work
\usepackage{tabularx}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}
\newcommand{\possessivecite}[1]{\citeauthor{#1}'s (\citeyear{#1})}
\usepackage{pdfpages}
\usepackage{hyperref}
\usepackage{pdflscape}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{landscape}
\setcapmargin[2cm]
\begin{figure}[]
\captionsetup{justification=centering}
\caption{Main Caption. }
\label{fig:val_efcts}
\begin{subfigure}{0.55\textwidth}
\caption{X}
\includegraphics[width=\textwidth] {example-image-a}
\end{subfigure}
\begin{subfigure}{0.55\textwidth}
\caption{Y}
\includegraphics[width=\textwidth] {example-image-b}
\end{subfigure}
\begin{subfigure}{0.55\textwidth}
\caption{Z}
\includegraphics[width=\textwidth] {example-image-c}
\end{subfigure}
\captionsetup{justification=raggedright} \subcaption*{This subcaption is supposed to be ragged right and intented by 4 cm. \\ This is in a new line.}
\end{figure}
\end{landscape}
\end{document}
It should be self-explanatory, mostly. I'd like the last subcaption below the picture to be ragged right, but indented 2 cm. I tried to use \setcapmargin, but that does not work, creating the "undefined control sequence" error (so it's an unknown command).
Since you're writing a caption without numbering, set it in a \parbox where you have some more control over the placement and alignment:
\documentclass{article}
\usepackage{graphicx}
\usepackage[hang]{caption}
\usepackage{subcaption}
\begin{document}
\begin{figure}[]
\captionsetup{justification=centering}
\caption{Main Caption. }
\label{fig:val_efcts}
\begin{subfigure}{0.3\textwidth}
\caption{X}
\includegraphics[width=\linewidth] {example-image-a}
\end{subfigure}\hfill
\begin{subfigure}{0.3\textwidth}
\caption{Y}
\includegraphics[width=\linewidth] {example-image-b}
\end{subfigure}\hfill
\begin{subfigure}{0.3\textwidth}
\caption{Z}
\includegraphics[width=\linewidth] {example-image-c}
\end{subfigure}
\hspace*{4cm}%
\parbox{\dimexpr\linewidth-8cm}{\raggedright
\strut This subcaption is supposed to be ragged right and indented by 4cm. \\
This is in a new line.\strut%
}
\end{figure}
\end{document}
Note the use of \struts to support correct baseline alignment when dealing with text inside \parboxes. For more on this, see How to keep a constant baseline skip when using minipages (or \parboxes)?

Resources