How to reduce the size of captions in all figures - latex

I want the captions of my figures and table to have the same size as \footnotesize. Is there something to put in the preambule of my document to do this?

Use the caption package to set the font key-value to footnotesize:
\documentclass{article}
\usepackage{caption}
\captionsetup{font=footnotesize}
\begin{document}
Some regular text set in \verb|\normalsize|.
\begin{table}[t]
\caption{A table using \texttt{\string\footnotesize}.}
\end{table}
\begin{figure}[t]
\caption{A figure using \texttt{\string\footnotesize}.}
\end{figure}
\end{document}
It is also possible to adjust the label and text formats individually for figures and tables separately. However, consistency is a better option here.

Related

How could I change the numeration style in table of contens in beamer (Latex)?

Hello I am new at beamer (overleaf), so I have learned very much, so I would like to change the design of the numeration in table of contents. I mean with that (see picture attached):
I would like to change to a square, or simply the number. Anyone knows others styles? I am using the \usetheme{CambridgeUS}.
You can set the sections/subsections in toc template to change to e.g. a square or plain numbered sections:
\documentclass{beamer}
\usetheme{CambridgeUS}
\setbeamertemplate{sections/subsections in toc}[square]
%\setbeamertemplate{sections/subsections in toc}[sections numbered]
\begin{document}
\section{title}
\begin{frame}
\tableofcontents
\end{frame}
\end{document}

Changing Margin in LaTeX

I'm new to LaTex and I wanted to know how I can change the Margins of my scrreport so that the chapter title, text and basically everythin starts a bit higher and ends a bit lower. In my opinion there is too much empty space before anything starts.
If I use this simple example:
\documentclass[12pt,a4paper,twoside]{scrreport}
\usepackage{blindtext}
\begin{document}
\chapter{First Chapter}
\blindtext
\end{document}
I think the margins from top and bottom are too big. So i want everything to move up a little bit.
Thanks!
Method 1:
Choose one of the predefined layouts. You'll find a list of available options in the koma script documentation.
\documentclass[12pt,a4paper,twoside,DIV=15]{scrreport}
\usepackage{blindtext}
\begin{document}
\chapter{First Chapter}
\blinddocument
\end{document}
Method 2:
Setting up the text area manually. You should be really sure that you know what you are doing to get an aesthetically pleasant result.
\documentclass[12pt,a4paper,twoside]{scrreport}
\areaset[current]{168.00mm}{250mm}
\usepackage{blindtext}
\begin{document}
\chapter{First Chapter}
\blinddocument
\end{document}

How to resize emoji image using scalerel

I want to insert emojis in latex table and for this I have followed all steps as done in http://www.thetawelle.de/?p=5539
But the size of emoji is very small. I need help as to how to increase size of emoji in the table.
\usepackage{scalerel}
\def\emojif60d{\scalerel*{\includegraphics{f60d.pdf}}{O}}
In the the table I have used: \emojif60d.
You do not need scalerel. It is mostly useful for scaling text, math, etc.
There is all that is required in the \includegraphics macro.
either scale=<scale_factor>
or width=<desired_width> (or height=<desired_height>)
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
\includegraphics[scale=0.5]{1F600}&
\includegraphics[scale=1]{1F600}&
\includegraphics[scale=2]{1F600}&
\includegraphics[scale=4]{1F600}&
\includegraphics[scale=8]{1F600}\\\hline
\includegraphics[width=0.25cm]{1F600}&
\includegraphics[width=0.5cm]{1F600}&
\includegraphics[width=1cm]{1F600}&
\includegraphics[width=2cm]{1F600}&
\includegraphics[width=8cm]{1F600}\\
\hline
\end{tabular}
\end{document}
To scale all occurrences of the emoji, you could include the scale in the definition, e.g.
\documentclass{article}
\usepackage{scalerel}
\def\emojif60d{\includegraphics[width=2em]{1F60D.pdf}}
\begin{document}
\emojif60d
\end{document}
If it should only be scaled sometimes, you could use \scalebox from the graphicx package or use a bigger font size, e.g.
\documentclass{article}
\usepackage{scalerel}
\def\emojif60d{\scalerel*{\includegraphics{1F60D.pdf}}{O}}
\begin{document}
\scalebox{3}{\emojif60d}
\emojif60d
\Huge\emojif60d
\end{document}
The latter approach will have the advantage that you will still be able to use the emoji inside of normal text and the size will be adapted to the font size.

Latex List of Figures

So i'm trying to hide the label in my cover image.
>\begin{figure}
>\center
>\includegraphics[scale=0.5]{universidade}
>\caption* {Mycaption}
>\end {figure}
This way it's not labeling the figure but its not showing on the list of figures
Help please ;D
You can give the caption package the option labelformat=empty to suppress the Figure 1 etc. labelling:
\usepackage[labelformat=empty]{caption}
You can use square brackets to specify the description for the figure list, and curly brackets for the actual figure caption. So I think you should be able to do the following to supress the caption but still have an entry in the figure list:
\begin{figure}
\center
\includegraphics[scale=0.5]{universidade}
\caption[Mycaption]{}
\end {figure}
There are a couple of options, depending on what yo're after exactly:
\documentclass{article}
\usepackage{graphicx}
\setcounter{topnumber}{3}% Just for this example
\begin{document}
\listoffigures
\begin{figure}
\addcontentsline{lof}{figure}{Example image A}%
\centering
\includegraphics[height=4\baselineskip]{example-image-a}
Example image A
\end{figure}
\begin{figure}
\addcontentsline{lof}{figure}{\protect\numberline{}Example image B}%
\centering
\includegraphics[height=4\baselineskip]{example-image-b}
Example image B
\end{figure}
\begin{figure}
\centering
\includegraphics[height=4\baselineskip]{example-image-c}
\caption{Example image C}
\end{figure}
\end{document}
The figure caption is added using \addcontentsline{lof}{figure}{<caption>}, where <caption> can either contain a blank \numberline{}, or just the regular caption. The above example shows the usage of either.
It would also be possible to have no label shows in the image, but have a numbered entry in the LoF using caption. But it would seem strange to have a numbered entry in the LoF and an unnumbered figure.

Latex: center text within listing

How do I center text within a listing in Latex?
Or another way not using listing. (Need a box with monospace font)
The answer given at tex.stackexchange is:
\documentclass{article}
\usepackage{listings}
\renewcommand{\figurename}{Listing}
% replace figurename with the text that should preceed the caption
\begin{document}
\begin{figure}[thp] % the figure provides the caption
\centering % which should be centered
\caption{Ausgabe des C-Programms}
\begin{tabular}{c} % the tabular makes the listing as small as possible and centers it
\begin{lstlisting}[label={gtt_c_ausgabe}]
printf("Your code goes here.\n");
\end{lstlisting}
\end{tabular}
\end{figure}
\end{document}
...which still leaves me wondering:
Using a frame around the code, e.g. using \lstset{frame=single,frameround=tttt}, places the frame way over to the right. How can this be avoided?
What does the renewcommand bit do?
I don't have an answer for the listing package on top of my head, but you could try the following:
\framebox[.9\linewidth]{\parbox{.85\linewidth}{\tt Hello World\\Second line}}
That produces a box with 90% of the line width, with text of width 85% of line width.
If you want it centered you just put \centering in front of the \tt command:
\framebox[.9\linewidth]{\parbox{.85\linewidth}{\centering \tt Hello World\\Second line}}
If you prefer the box without a frame, simply change \framebox into \makebox (and keep the arguments as they stand).

Resources