{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)

140
votes
1answer
24k views

Should I use center or centering for figures and tables?

What is the correct way to center figures and tables (figure, table)? \begin{center} ... \end{center} or \begin{centering} ... \end{centering}
54
votes
3answers
17k views

Center figure that is wider than \textwidth

I have a figure that is wider than the \textwidth of my document. (I don't want to change the \textwidth.) As a result, the leftmost part of the figure is flush with the left margin, while the ...
63
votes
2answers
44k views

When should we use \begin{center} instead of \centering?

After reading this question Should I use center or centering for figures?, I want to know the answer of the following. When should we use \begin{center} instead of \centering? For example, should we ...
60
votes
1answer
7k views

Manual/automatic line breaks and text alignment in TikZ nodes

How can I insert a line break in a TikZ node? Simply putting \\ where I want the break doesn't work (see MWE). Is there a way to make lines break automatically at some specified width? And can I ...
25
votes
7answers
600 views

Writing a table with equally spaced columns, based on the widest column

Friends, I'm trying to generate a table in which I have all columns equally spaced (same width). In my case, the width for all columns would be the width of the widest column of the table: ...
61
votes
2answers
83k views

How to create fixed width table columns with text raggedright/centered/raggedleft?

I would like to create a table with some columns' width specified, while the text in those columns should be centered both horizontally and vertically. I found out that \usepackage{array} ...
22
votes
2answers
7k views

How can I center a too wide table?

I have a document containing a table which is slightly too wide for the page. But instead of growing to the right side only, I would like to have it centered on the page. I have tried to use the ...
11
votes
2answers
3k views

Balancing long table inside multicol in LaTeX

I would like to put some longer tabular data inside the multicols environment while maintaining its balancing abilities. I have tried supertabular with the trick to redefine \newpage as columnbreak. ...
49
votes
1answer
13k views

Aligning numbers by decimal points in table columns

Let me begin by stating that I did google the answers (and I'll reference to them soon). Yet each of the resources I found discussed one particular method, I'm interested in a comparison of the ...
29
votes
2answers
19k views

Center column with specifying width in table (tabular enviroment)? [duplicate]

I have table that has long headers and I would like to specify width of the column, but also be able to remain it's centred position. Something like |c{0.30\textwidth}|. It is possible? How to ...
18
votes
4answers
4k views

Place figures side by side, spill into outer margin

I would like to place two figures side by side (not subfigures) and what’s more, I’d like to let the figures spill into the outer margin (since they are too wide for the the text width. Like this: ...
13
votes
3answers
15k views

How to format the chapter heading?

How can I change the chapter heading of the book class to typeset centered chapter names as shown in the image above?
10
votes
4answers
238 views

Bump right-aligned text to next line iff no room

I a chat discussion it was suggested that \hspace*{\fill} (with a space before it to allow for a line break) was sufficient to always get the text following aligned to the right. And indeed, it is ...
15
votes
2answers
5k views

Raggedleft and raggedright simultaneously

This seems trivial, but I'd like a single line to have some text with left-justification and right-justification at the same time, eg. left text here ...
15
votes
3answers
1k views

Is there a way to measure the remaining space of a line of text?

I'd like to write the following: Some long paragraph of text \measureremainder{\whatsleft}\begin{mimipage}{\whatsleft} stuff \end{minipage} so that the minipage takes up exactly the remaining ...
26
votes
2answers
21k views

Vertically center cells of a table?

What is the easiest way to center align each row of table? I have a table column that contains an image and other cells in the same row contain text. I would like to know how to vertically center ...
7
votes
2answers
2k views

Centering a TikZ picture around an area

I often find myself in the following situation: A tikzpicture of mine consists of a main area and some outer material like text labels which are hardly symmetric around the main area. If such a ...
8
votes
3answers
20k views

How can I use an align environment flush left?

Is there a way possible to imitate the align environment for math mode commands, without having all writing being placed toward the center on the output page? MWE: \documentclass{article} ...
22
votes
1answer
6k views

How to center a listing?

I'm trying to get some console output in my homework. I put it in a listings environment but I want it to be centered horizontally on the page. The only thing I get centered is the caption ;-/ ...
23
votes
2answers
8k views

Line breaking of URLs in bibliographies

I have a problem with the line break of an URL. The URL can´t break correct and extends into the border. I´ve tried some things. Amongst others I loaded the package breakurl, but without any success. ...
16
votes
6answers
4k views

Align two inequalities

I am trying to align two inequlities vertically. The \le signs should have the same horizontal positions and the term in the should be centered. My first attempt: \begin{align*} \sum a &\le \sum ...
14
votes
3answers
18k views

How to make enumerate items align at left margin?

I would like to have my lists to have no indent for the top level, i.e. having the same left margin as the surrounding paragraph, with just enough space for the widest label to fit: Paragraph text ...
8
votes
1answer
8k views

Left align (to the page) displayed math

How can I left align the display math environment (either $$ or \[)? I keep running into people asking about the align environment; but I just want to change displayed math from center to left align ...
4
votes
2answers
2k views

Center flow chart horizontally

I have the following flow chart but it appears uncentered. How can I center it? \documentclass{article} \usepackage{pstricks} \usepackage{pst-node} \usepackage{pst-blur} \pagestyle{empty} ...
52
votes
4answers
7k views

What is the difference between 'fil' and 'fill'?

TeX provides the commands \vfil and \vfill (and their corresponding horizontal versions \hfil and \hfill). These commands are actually defined as: \vskip 0cm plus 1fil \vskip 0cm plus 1fill where ...
37
votes
6answers
6k views

Best way to create an system of equations environment?

I am trying to write a few systems of equations, and I want the terms to be nicely spaced as below 2x + y + 3z = 10 \\ x + y + z = 6 \\ x + 3y + 2z = 13 Now, using ...
33
votes
5answers
41k views

How to make text aligned left/center/right in the same line?

I am trying to align some text to left/center/right in the same line. For example, I want to put my phone number on the left, my name in the center, and my email on the right, how do I do that?
11
votes
3answers
6k views

How can I center all tables in a document?

Background Would like to center all tables within floats, without having to add \centering to each table. Ideas Tried the following: \let\originaltabular\tabular ...
20
votes
5answers
12k views

How can I automatically center an image?

I use: \documentclss{mwrep} ... \begin{figure} \includegraphics{a.jpg} \caption[Long caption]{Caption} \label{pic-a} \end{figure} How can I make images to be always visible on the center of page? ...
12
votes
2answers
2k views

Array with labeling columns

Is there an intelligent way to label (or name) columns in a matrix? I would like to have something like \[M=\left[\begin{array}{c|cc} 1 & 2 & 3\\ 4 & 5 & 6 ...
18
votes
4answers
2k views

Centering \section* and adding them to the ToC

I'm using LaTeX and the book class and have one problem: I want that my starred sections (only starred sections) appear in the center of the pages instead of the left side of the pages and also these ...
6
votes
1answer
1k views

Displaying two XML listings side by side. [duplicate]

I have two XML outputs from a program that I would like to include in a LaTeX document. I would like them to appear side-by-side each in its own box. So that a reader can compare the two outputs while ...
28
votes
3answers
5k views

Centering \vdots in a system of many equations

I have a system of equations with an arbitrary number of equations (k). I'd like to use \vdots to compactly describe the system, like so: \begin{align*} R(-1) &= \sum_{i=1}^m A(i)R(i-1) \\ ...
11
votes
2answers
807 views

Center caption in listing

I want to put the caption of my listing in the center but I can't do that. Do you have any idea how I could achieve this? The code: \documentclass{report} \usepackage{color} \usepackage{xcolor} ...
14
votes
4answers
508 views

Bump right-aligned text to next line if no room

I'm trying to write a simple command that will put some text right-aligned, but bump it to the next line if it doesn't fit well. Since an image is worth a thousand words: The "Normally" case is ...
16
votes
1answer
3k views

Description list with aligned descriptions

This forum thread is exactly what I'm looking for. I want my description environment to produce this: Label is long text lab2 blalballalaa label3 possible second rule label ...
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
1answer
272 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} ...
7
votes
1answer
2k views

How do I set right alignment in a longtable column with a fixed width?

How do I set right alignment in a longtable column with a fixed width? I have \begin{longtable}{p{3cm}p{8cm}} and I'd like my first column to be aligned on the right.
4
votes
1answer
267 views

Incorrect line spacing when using \Large in a center environment

When I enclose text with line breaks within a center environment, there is extra space after the first line, but only if the font size has been changed. The following working example prints the same ...
16
votes
3answers
21k views

Use flalign or alignat or align or similar environment to align to the left

The following is a small example to use flalign environment to generate equation. \documentclass{article} \usepackage{amsmath} \usepackage{txfonts} \begin{document} The formula is: \begin{flalign*} ...
11
votes
2answers
1k views

How to align comments with lstlistings?

I am using listings with these settings: \lstset{language=C++,basicstyle=\small\sffamily, numbers=none, frame=tb, columns=fullflexible, showstringspaces=false } I like the proportionally ...
15
votes
1answer
4k views

Description list with right alignment of labels

I want a description list that looks like the following: Name | Joel Spolsky Address | Some address Some zipcode Telephone | +31 123 456 E-Mail | ...
13
votes
2answers
3k views

Split-like environment inside cases environment

I'd like to have a cases environment with some cases that are too long to fit on one line. I tried this: \begin{cases} \begin{split} long expression \\ second line of long expression ...
17
votes
1answer
427 views

Precision copyfitting in xcoffin

Further indulging my curiosity with xcoffins, I'm playing with xcoffins-tschichold-example.tex. In the TeX reconstruction of the front page of Elementare Typographie, the text is slightly misaligned ...
12
votes
2answers
14k views

Text wrap in tables (multirow package loaded)

I searched a bit, but I could not find a reliable way to wrap text in tables with columns spanning more than one row. Any ideas on how to fit this table in the page?: ...
9
votes
1answer
11k views

text justify in beamer

I like to justify the texts inside the block using beamer. I cant do that in presentation. Can any one please help me?
22
votes
3answers
11k views

How do I left-align entries in a matrix with \begin{matrix}?

I'd like to left align the -1 entry in the following matrix so that the 1s line up. Is there a way to get matrices to ignore signs in that way? \begin{matrix} 1 & 1 \ 1 & -1 \ ...
13
votes
2answers
5k views

How can I center text/math inside a list environment?

When using math (display) mode in conjunction with a list environment, the displayed material is not truly centered on the page; it is only centered with respect to the indentation of the item. ...
12
votes
3answers
4k views

Centering in tabularx and X columns

How can I center the column when using X in tabularx environment like in this example? \begin{tabularx}{\textwidth}{@{}lXXXXX@{}} 1 & 2 & 3 & 4 & 5 \\ \end{tabularx}