Questions tagged [align]

Use the align tag for questions about aligning text vertically. For example, formatting tables so the columns in a row line up under the columns in the previous row; or having consecutive rows of text arranged to keep a symbol/separator in the same column, such as the equal sign in equations, or a series of variable assignments.

The Emacs functions align, align-current, align-entire and align-regexp support different ways of achieving text alignment.

77 questions
36
votes
2 answers

Understanding of emacs align-regexp

I've read the Emacs documentation for align-regexp but still have difficulty in understanding how it works. What I'm talking about is its prefixed form C-uM-xalign-regexp, not the simple form M-xalign-regexp. Here are my questions: Does the first…
Just a learner
  • 547
  • 5
  • 11
15
votes
2 answers

Is there an auto-align package or mode for Emacs?

There are times when I'm editing files (Puppet manifests, for example) where I want to align buffer contents on the fly. For example, I know that I can use align-regexp or align to align code like this, as long as I have it selected: # M-x…
14
votes
2 answers

Align columns in Org mode table with Japanese fonts

How can I mix Japanese and English in the same org-mode table (that uses fixed-width fonts)? Something like: | m m m m m m | | | はどう デシウ | | | ハーフ | ハーフ | won't align. Emacs simply counts the Japanese characters as one,…
Quora Feans
  • 515
  • 3
  • 11
12
votes
2 answers

Aligning multi-lined equations and tables in latex-mode

Let's say I'm editing a latex in Auctex's latex-mode, and I have the following equation. This is just indented with indent-region. \begin{align} \phi & = a + b + c + d \\ & = a + b + c + d + e \end{align} The above alignment is what…
Malabarba
  • 22,878
  • 6
  • 78
  • 163
11
votes
4 answers

How to make emacs align and indent a bibtex entry?

I want bibtex-mode to align and properly indent fields. I copied a bibtex entry for the following article into Emacs: (Article source here) But, with a simple paste, the alignment is lost in Emacs and the indentation is messed up: The TAB key…
Viesturs
  • 805
  • 8
  • 19
10
votes
1 answer

How to right align region and/or line?

We can center text with M-x center-region and M-o M-s. Is there something similar for right-alignment? Example before: Item 0: value | Item 100: value …
Mark Karpov
  • 4,893
  • 1
  • 24
  • 53
10
votes
2 answers

How to better align tags in Org Mode using variable-width font

I prefer using variable-width fonts in Emacs whenever I can. That said, Org Mode tags are horribly aligned when headings use variable-width fonts, even if the tags themselves use fixed-width fonts. Is it possible to continue using variable-width…
kgo
  • 532
  • 3
  • 15
9
votes
1 answer

Align vertical columns of numbers on the decimal point

I wrote this post in Emacs. In order to make the tables look nice, I decided to adjust the spacing so that decimals line up neatly. The original format from the database looked like this: emacs 11505 227 3.6 3.3 …
9
votes
1 answer

Emacs align matrices

Since I find myself writing a lot of matrices and tables, I'm looking for a way to align numbers nicely in Emacs (similar to the align package in vim). I found that there is align-regexp, but I couldn't get it to work the way I wanted. Is there a…
DayAndNight
  • 103
  • 5
6
votes
1 answer

How align tabs inside block of string?

For example, I have the following code snippet: $query = 'SELECT SUM(T01.foobar) FROM db_foo.bar T01 WHERE T01.fooID = 1 AND T01.barID = 2 AND T01.foo IS NOT NULL' I would like to align it…
ReneFroger
  • 3,855
  • 22
  • 63
5
votes
1 answer

How to right-align with align-regex?

Initial buffer &ei = wFSXYvnUEvaL6dsP9f2HsAE &ip = 195.201.109.29 &id = o-AD7SgDnv171kT3qy-KSuSbDZ3zX4YR5X7cS6Mmq237oY &itag = 22 &source = youtube &requiressl = yes &vprv = 1 &mime = video%2Fmp4 &cnr = 14 &ratebypass = yes &dur = 193.863 &lmt =…
ychaouche
  • 207
  • 1
  • 7
5
votes
1 answer

How to get align-regexp to help line up Markdown tables properly?

I am trying to line up a text table using align-regexp. A table, before alignment, looks like this: | Alpha | Bravo | Charlie | |-------|-------|---------| | Delta | Echo | Foxtrot | | Golf | Hotel | India | and after alignment should look like…
rityzmon
  • 181
  • 3
4
votes
0 answers

Prettify symbols without screwing up alignment

Is there a way to prettify symbols without running into alignment issues? E.g. replacing not with ¬is visually pleasing, but screws up code alignment, b/c not is 3 chars while ¬ is one char. Since prettifying symbols only changes the way text is…
Tianxiang Xiong
  • 3,848
  • 16
  • 27
4
votes
1 answer

How to make Emacs align-regexp work with leading spaces

If I try and use emacs C-u align-regexp on the below with \(\s-*\)| and 1 and 1 and y I get an incorrectly formatted result: Foobar Foobar foobar| foobar foobar | || Incorrectly formatted result: Foobar Foobar foobar |…
Mike H-R
  • 265
  • 1
  • 8
3
votes
2 answers

Vertically aligning text in emacs

I am writing this mode where I only want to show one paragraph at a time. Ideally I'd like to show the paragraph in the center of the screen. Getting it horizontally centered is trivial, but I have not found out how to enter text vertically. What do…
The Unfun Cat
  • 2,393
  • 16
  • 32
1
2 3 4 5 6