{horizontal-alignment} is about aligning document elements horizontally, e.g. typesetting paragraphs using \centering or \raggedright or adjusting the horizontal position of several equation or table components. If your question is generally about (horizontal) white space, use {spacing} instead.

learn more… | top users | synonyms (6)

9
votes
2answers
5k views

How to align source code produced by listings package with main paragraph text

I'm using the latex listings package for the first time to format some HTML. I'm noticing that by default, the html code is being pushed further left than the main paragraph text of my document. Is ...
9
votes
1answer
12k views

How to center a specific caption?

I'm having a problem with centering my figure captions. Particuarly, I know that we can use \usepackage[justification=centering]{caption} to center captions, however, I'm interested in just centering ...
9
votes
1answer
263 views

How to split and align equations when they are inside an enumerate environment?

How to make the first line of aligned equations sit in the same baseline as the bullet and make the equation left justified? \documentclass{article} \usepackage{amsmath} \begin{document} ...
9
votes
1answer
210 views

Using discretionary linebreaks in centering environment

I am having trouble with the interaction between discretionary line breaks and centering. I have defined macros for math mode that contain discretionary line breaks to help TeX lay out inline ...
9
votes
1answer
135 views

How can I align the terms of this equation nicely?

I have the following alignat segment: \begin{alignat*}{3} \text{max}_{\underline{\lambda}} \text{min}_{\underline{x}} \quad & \underline{c}^T \underline{x} + \underline{\lambda}^T(\underline{d} ...
9
votes
1answer
2k views

How to center a lstlisting

I have the following problem. I want to center a listing, I tried this approach: How to center a listing? It works but when I try to set frame or numbers specifically for each listing I get errors. ...
9
votes
2answers
118 views

Preventing line shrinking with raggedright

Sometimes with \raggedright, if a line is too long, but only slighly so, it will be shrunk instead of broken up. Here is an example: \documentclass{article} \raggedright \begin{document} This is a ...
9
votes
2answers
3k views

How to center verbatim [duplicate]

\begin{figure} \centerline \begin{verbatim} for (int a = 0; a < 10; a++) for (int b = 0; b < 10; b++) ... \end{verbatim} \caption{C++ code} \end{figure} I would like the figure to be ...
9
votes
3answers
897 views

Leftalign labels with enumitem

I'm using the enumitem package to define a legal list: \usepackage{enumitem} \newlist{legal}{enumerate}{10} \setlist[legal]{label*=\arabic*.} The output for a list looks like this: 1. foo 1.1 ...
9
votes
1answer
896 views

\mathclap not centering

I'm trying to stack two symbols on top of each other (not \stackrel) using \mathclap in the mathtools package, but the symbols are not centering: \mathclap{\rightleftharpoons}\circ How do I get the ...
9
votes
3answers
245 views

Remember position of equal sign from one align environment to the next

As you know, the align-environment puts all positions marked with & (normally the equals sign) exactly beneath each other. I now want to save the position LaTeX calculates for & and use it ...
9
votes
1answer
139 views

How to float something right even if it wraps down a line?

I have a situation where I have some data in section headings (and sometimes normal paragraphs} that needs to be: floated right not split across lines I was able to accomplish this for most cases ...
9
votes
1answer
214 views

Centering contents name with [twocolumn] contents

I'm trying to make Table of Contents in two columns, but I'd like to center the contents name. Now I'm doing \twocolumn \tableofcontents but these commands give something like this: Contents name ...
9
votes
1answer
403 views

Alignments by means of the tikzmark macro

This is a follow up of my previous question Issues and potentiality of the tikzmark macro: dynamic box adaptation. I thought should have been better to ask two questions although they are related to ...
9
votes
2answers
390 views

Help me create my out patient documentation template

\documentclass[a5paper]{article} \usepackage{eso-pic} \usepackage{fancyhdr} \usepackage[pdfauthor={VB},% pdftitle={Consultation},% pagebackref=true,% ]{hyperref} \usepackage[headsep=3cm,top=4cm, ...
9
votes
1answer
802 views

One-line equation with two columns

I try to write an equation with two similar formulas, i.e. \begin{equation} \qquad A_1 = B + C \qquad A_2 = D + E \qquad \end{equation} Of course, instead of \qquads I want to use something like ...
9
votes
1answer
680 views

Text justification within multicols environment

I'm using this 3-column layout. \begin{multicols}{3} [.. a lot of text ..] \end{multicols} I want to left-align the text in the left column, center the text in the middle column, and right-align ...
9
votes
2answers
692 views

Protrusion of fractions in tabulars

I have a number of tables in a book that I am busy with that have quite a few tables of the general form shown below: If you notice the fractional part of the numbers 5 1/2 and 16 1/2 protrude to ...
9
votes
2answers
443 views

How, in ConTeXt, can I get body text to align flush to the outside?

I'm using ConTeXt Mk IV, and I'd like the text in a two-page document to line up like so: +--------+--------+ + + + + xxx + xx + + xxxx + xxx + + xx + + + ...
9
votes
1answer
1k views

How to have a figure touch the edge of the page?

How can I position a figure (picture) so that it: is aligned on the left-hand side with the text (this is in two column page) touches (or exceeds) the right-hand side of the page? An example can ...
8
votes
5answers
4k views

fully stretch text horizontally on page

Is there a way to fully stretch one line of text on the full width of the page, without manually setting the letter spacing, no matter how many characters on the line?
8
votes
5answers
4k views

Table will not center (and it is spilling off the right side of the page)

I just generated this table using Excel2LaTeX: Even though I enclosed the table in \begin{center} the table did not get centered. The table still sticks out the right side. Is there somehow that ...
8
votes
4answers
239 views

How to align five equations on three lines, e.g., 2-2-1, with the last equation centered?

I'm trying to use the alignat environment to arrange five equations on three lines as follows: two equations on the first line, two equations on the second line (aligned with those of the first ...
8
votes
4answers
1k views

Centered but left-aligned paragraph

I want to have a paragraph, that is centered but in itself left-aligned. Does somebody of you know how to achieve this? (I have text in a paragraph, on each line the text is shorter than the width, ...
8
votes
3answers
194 views

Control the alignment of each “cell” in amsmath's aligned environment

In amsmath's aligned environment, the alignment of each "cell", or each "column" is predetermined, and seems to work in the following way: the first "column" is aligned to the right, the second to the ...
8
votes
2answers
17k views

Section Heading Centering problem

\begin{center} \section*{\textcolor{blue}{Ukaaranta }} \end{center} \subsection*{Shabhu Harivat} \addcontentsline{toc}{subsection}{shambhu harivat} \begin{center} ...
8
votes
3answers
136 views

Aligning elements in set

How can I create a set with aligned elements? Example: I tried using align but it does not align as nicely as in the example. \begin{align*} &P = \set{ &A &\rightarrow &a | ...
8
votes
4answers
403 views

Decimal separator and axis label centering with Tikz

The following code creates a figure with Tikz without the use of pfgplots (that I want to avoid here): % compilation: pdflatex --jobname=Runge-f1 Runge.tex \documentclass[12pt]{book} ...
8
votes
2answers
7k views

Numbers in tables: align by decimal point *and* flush right?

This is a followup question to siunitx: aligning numbers by decimal points in tables doesn't work for bolded or italicized numbers and Aligning numbers by decimal points in table columns. While ...
8
votes
5answers
351 views

centering a part of an equation

I am using \vdots in my equation, and I need it to be centered. As shown in the figure it is automatically left indented. I am not able to bring the dots to the center. I am providing MWE also. ...
8
votes
3answers
351 views

Poster text positioning: Get width of \hfill

How can 0123456789 be aligned as shown in red: Same baseline as abcdefghij, aligned left with ABCDEFGHIJKL? \vlines are just for illustration. I am designing a poster where exact text positioning ...
8
votes
2answers
205 views

Multiple equations with a large “{” in front: alignment and labelling

I'm trying to get the equation shown in the picture. But i only manage to get the following coding. Can anyone help me to label it with numbering like the picture? I tried with \begin{eqnarray} or ...
8
votes
5answers
21k views

Center table on page

I would like to center a table on the page, not only the content. But I can't find the right keyparameter or command. I have follwing table \documentclass[11pt]{scrartcl} \usepackage{multirow} ...
8
votes
3answers
2k views

horizontal alignment of dot over hat over bold greek letter!

For some strange reason, this: \hat{\dot{\bm{\phi}}} prints the dot and the hat slightly off the left of the phi letter. Any ideas if this can be fixed? thanks. Using bm package for bold symbols.
8
votes
3answers
185 views

box the size of A containing B

A thing I'd often like to do is put in my document a box the size of some text A and containing some other text B. For instance, I have two tikz nodes, one containing $n$ and one containing $n+1$, and ...
8
votes
3answers
3k views

How to put two images side by side and put some symbol in the center?

I want to put two images side by side and put a comparison symbol in between them. Here is the tikz code : \documentclass{article} \usepackage{tikz} \usepackage[margin=15mm]{geometry} ...
8
votes
3answers
2k views

How to align piecewise functions?

I have two piecewise functions defined like this: \begin{align*} \left\{ \begin{array}{ll} i = x^2 + y^2 \\ j = a^2 + b^2 \\ \end{array} \right. \\ \left\{ ...
8
votes
2answers
267 views

Have almost managed to get my TOC the way I want, but need help making it 100% perfect

If you compile my current TOC code: \documentclass[a4paper,10pt]{book} \usepackage{lipsum,kantlipsum} \usepackage[dotinlabels]{titletoc} \contentsmargin{0pt} ...
8
votes
2answers
1k views

Mixing enumerate and tabbing, whats wrong here?

So I can't seem to figure out whats wrong with my LaTeX file. Do you guys see anything obvious? \documentclass[11pt]{article} \newcommand{\df}[1]{\textbf{#1}} \begin{document} \section{Midterm 1} ...
8
votes
1answer
6k views

Multiline figure caption centering

How to center a figure caption that's too long for a single line? Or at least, make the text in other lines line-up with text after "Slika 1:". It currently looks like this
8
votes
2answers
104 views

How to align only some equations in an align environment?

Here's what I got: \begin{align*} P[E_{m}] &= P[m] + P[2m] + P[3m] + \dots \\ &= \frac{1}{\varsigma(s)} \langle m^{-s} + (2m)^{-s} + (3m)^{-s} + \dots \rangle \\ &= \frac{1}{\varsigma(s)} ...
8
votes
3answers
444 views

TikZ Matrix - How can I align content horizontally which is spanning over multiple cells/rows?

I'd like to finetune the big rectangle in the last column and its content, i.e. that it's all aligned to the third column's center. It is currently too far on the right: So far I have been unable ...
8
votes
2answers
3k views

siunitx: aligning numbers by decimal points in tables doesn't work for bolded or italicized numbers

This is a follow-up question for Aligning numbers by decimal points in table columns. User lockstep provided this solution: \usepackage{siunitx} \begin{document} \begin{tabular}{S[table-format=3.2]} ...
8
votes
3answers
1k views

Justify a text inside a figure environment

I insert several figures in my document, but I am unable so far to fully justify the text just below the caption: "BLA BLA BLA" \begin{figure} \centering \caption{NICE TITLE}\label{graph:p} ...
8
votes
1answer
344 views

How to force equation to be closer to the sum operator?

I would like to know if it is possible to force the equation to be closer to the operation sum? When there are a lot of subscript under the sum operator, it tends to pouch the equation to the right, ...
8
votes
3answers
203 views

Multiple alignments

If I have a string of equations whose equal signs are aligned and one of the equations is too long and needs to span multiple lines, how do I create a second alignment. For instance, in the following ...
8
votes
2answers
1k views

ragged2e: “newcommands” option produces “underfull \hbox” warnings

The ragged2e package provides the commands \Centering, \RaggedRight and \RaggedLeft for setting ragged text while allowing hyphenation. The package offers a newcommands option that sets the standard ...
8
votes
2answers
104 views

Align \footnote left

At the moment my footnote looks like this ²Commit-Hooks definieren was die Softwareversionierung (zum Beispiel SVN) machen soll, sobald ein Commit passiert. The second line just does not align to ...
8
votes
2answers
224 views

How to horizontally align headers and decimal centered cells

I use this code to produce a table and to align the column with the dot of the numerical values. \documentclass{article} \usepackage{dcolumn} \begin{document} \begin{tabular}{l D{.}{.}{3} ...
8
votes
1answer
3k views

Centered frame title in beamer

How to set up beamer in a document so that frame titles are centered? Most of the themes seem to use left aligned frame titles.