Split caption of a figure into two equal lines [closed] - latex

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I would like to split for example the phrase:
Lower, upper and simulation throughput per user vs number of users
which appears in a caption of figure, into two lines in order for every line to have almost equal length. Something like the following:
Lower, upper and simulation
throughput per user vs number of users
How can I do that? I would appreciate any help!

You could wrap the contents in a varwidth environment (from the similarly-named varwidth package) of large-enough width. varwidth will shrink it to fit that natural content:
\documentclass{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{varwidth}% http://ctan.org/pkg/varwidth
\begin{document}
\listoffigures
\begin{figure}
\centering
\includegraphics[scale=.5]{example-image-a}% Image
\caption[Lower, upper and simulation throughput per user \textit{vs.}\ number of users]
{\begin{varwidth}[t]{\linewidth}Lower, upper and simulation \\ throughput per user \textit{vs.}\ number of users\end{varwidth}}
\end{figure}
\end{document}
The reason for specifying the caption twice (once in the option argument [] and once as part of the mandatory argument {}) is because sending a box-constrained piece of text to the ToC doesn't look great. So, this separates the formatting between the two document components. Depending on the document class you're using, it is also possible to make this part of the regular label-setting requirements.
The caption package also provides format=hang with justification=raggedright that seems to duplicate your requirement. However, you'll have to play with the margins to adequately obtain the output you're after.

Related

Why do LaTeX documents have a whacking great big space at the top? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed last year.
Improve this question
I am extremely new to LaTeX but have noticed that in the examples I have seen of LaTeX documents that there is always a massive number of empty lines at the top of the compiled pdf file. Nobody seems to say a word about this! Is this some kind of academic convention?
Here is an example:
\documentclass[]{article}
\usepackage{graphicx}
\title{Here is my title}
\author{Kevin Wright}
\begin{document}
\maketitle
\begin{abstract}
This is my abstract stuff
\end{abstract}
hello $\sqrt{x+y-10}$
\end{document}
Yes, by default the article class uses a lot of whitespace above the title of the paper. If you use a separate title page about 60 points of it.
With regard to the space on top of a regular page,
add \usepackage{layout} to your example, and just before the \end{document} add:
\section{Layout}
\layout
Now process and view the document and you will see exactly what the space on top of the page is made up of.
If you want to modify that, have a look at e.g. the geometry and fancyhdr packages.

How to change top and bottom page margins for odd and even pages? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
I have a problem with my LaTeX code. I want to change page geometry for odd and even pages. However, i also have to change top margins differently for odd and even pages.
All answers for odd and even page margins include actually change in right margin.
I am runnnig TeXMaker in Ubuntu with a Texlive-full.
\documentclass[a4paper,12pt,twoside]{report}
\usepackage[a4paper,margin=1in,landscape]{geometry}
\setlength{\oddsidemargin}{25mm}
\setlength{\evensidemargin}{40mm} #These change only left margin
Based on https://tex.stackexchange.com/a/332272/36296 maybe the following could help:
\documentclass[a4paper,12pt,twoside]{report}
\usepackage[a4paper,inner=1cm,outer=2cm,landscape,bottom=5cm]{geometry}
\usepackage{etoolbox}
\makeatletter
\patchcmd\#outputpage{\headheight}{\ifodd\count\z# 3cm\else 0.5cm\fi}{}{}
\patchcmd\#outputpage{\global\#colht\textheight}{\global\advance\textheight by\ifodd\count\z# 2.5cm\else -2.5cm\fi\global\#colht\textheight}{}{}
\makeatother
\usepackage{lipsum}
\begin{document}
\lipsum\lipsum\lipsum\lipsum
\end{document}

Latex Beamer Custom "Out of" Slide Number [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
I am doing Latex beamer and I want to have all slides appear out of 100 no matter how many slides I have.
So slide 1 will be: 1/100
slide 2 will be: 2/100
slide 3 will be: 3/100
I have no idea to do this?
With up-to-date beamer version:
\setbeamertemplate{page number in head/foot}{\insertframenumber /100}
(and maybe some footline template that shows the page number, but without seeing a minimal working example (MWE) that shows which theme your are using, this is pure speculation)
Compilable MWE:
\documentclass{beamer}
\usetheme{Berlin}
\setbeamertemplate{page number in head/foot}{\insertframenumber /100}
\begin{document}
\begin{frame}
content...
\end{frame}
\end{document}

How to make a full justify alignment in LaTeX article? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm beginner in LaTeX. I tried few examples, but I can't do a full justify alignment. Maybe this question isn't very annoying and you could help.
There is my code example:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[L7x]{fontenc}
\usepackage[lithuanian]{babel}
\usepackage{multicol}
\usepackage[left=1.5cm,right=1.5cm,top=2cm,bottom=2cm]{geometry}
\begin{document}
\title{text text text text text text text text text text text text}
\author {text text text text}
\date{}
\maketitle
\center{\textit{ text text text text text text}}
\center{\textit{ text text text text text text}}\\
\small\textbf{Abstract.}
An abstract is a brief summary of a research article, thesis, review, conference proceeding or any in-depth analysis of a particular subject or discipline, and is often used to help the reader quickly ascertain the paper's purpose. When used, an abstract always appears at the beginning of a manuscript or typescript, acting as the point-of-entry for any given academic paper or patent application. Abstracting and indexing services for various academic disciplines are aimed at compiling a body of literature for that particular subject.
\begin{multicols}{2}
\section*{\large Preface}
Academic literature uses the abstract to succinctly communicate complex research. An abstract may act as a stand-alone entity instead of a full paper. As such, an abstract is used by many organizations as the basis for selecting research that is proposed for presentation in the form of a poster, platform/oral presentation or workshop presentation at an academic conference. Most literature database search engines index only abstracts rather than providing the entire text of the paper. Full texts of scientific papers must often be purchased because of copyright and/or publisher fees and therefore the abstract is a significant selling point for the reprint or electronic form of the full text.
\section*{\large Some theory}
An abstract allows one to sift through copious amounts of papers for ones in which the researcher can have more confidence that they will be relevant to his or her research. Once papers are chosen based on the abstract, they must be read carefully to be evaluated for relevance. It is commonly surmised that one must not base reference citations on the abstract alone, but the entire merits of a paper.\\
\end{multicols}
\end{document}
Thank you in advance.
This
\center{\textit{ text text text text text text}}
is not the right way to do it. This \center takes effect for the eintire document. (This would also be the case with \raggedright or \raggedleft) There is no way to get back to justified alignment once you set the global alignment to something else (center raggedright or raggedleft)
You should put the brackets before the \center tag ... that is
{\center\textit{ text text text text text text}}
(this would however not put the text you want to center in the middle of the page but only into a box in the left part though the text will be centered in there). The clean way to do what you probably want to do is to use the center environment (\begin{center} and \end{center})
\begin{center}\textit{ text text text text text text}\end{center}

LaTeX - Adding a varying amount of horizontal spacing to the beginning of each new line in a sequence [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I'm using LaTeX for an algorithms assignment and I need to show the steps for Horspool's algorithm for string matching similar to what is shown in the textbook. The way it demonstrates the algorithm is showing how the pattern shifts along the text for each failed comparison, with each shift on a new line. The pattern is shown below the text with appropriate horizontal spacing indicating which letters are being compared.
Here is an example of what it would look like with a DNA sequence:
GAGTAATCCTTCACTTCAAGGCCAGTCTTCACATCTCATCAGA
ACATCTCA
ACATCTCA
ACATCTCA
ACATCTCA
I've poked around on several LaTeX references. I tried using \hspace to add the spacing at the beginning of each line, then adding \hfill after the pattern and before creating a newline. I'm not getting any errors, but there is no space being added at the front. The line is being filled correctly.
Is there another way to add the space to the beginning of each line, or another way to format this?
Just use \hspace*{5mm} (i.e. the starred form) which works fine at the beginning of a line.
I am fairly sure you want to typeset your examples with a fixed-width font, in which case, you should probably use verbatim environment. Even better, you could use fancyvrb package, which gives you a Verbatim environment, and allows you control over captioning, coloring, font size/shapes, etc. You can even make blanks more visible by showing them:
\documentclass{article}
\usepackage{fancyvrb}
\begin{document}
\begin{Verbatim}[showspaces=true,fontsize=\small]
GAGTAATCCTTCACTTCAAGGCCAGTCTTCACATCTCATCAGA
ACATCTCA
ACATCTCA
ACATCTCA
ACATCTCA
\end{Verbatim}
\end{document}
For this, I always add an "empty" object to the beginning of the line, e.g.
${}$\hspace{5em}Foo
it's not beautiful, but serves the purpose.
I would simply use the listings package and do the indention with spaces or tabs.
I suppose that you are using the typewriter font anyway to get letters with a non-relative width.

Resources