2022 Developer Survey is open! Take survey.

Hot answers tagged

146 votes

Horizontal line spanning the entire document in LaTeX

Another option is this one, which makes a horizontal line stretch the entire page. I prefer this one, because it's short, easy to remember and exactly what I need. I hope this works for you too. \...
user avatar
  • 1,717
123 votes

Draw a horizontal line in latex

I see two choices, one using \rule (as suggested by @John Kormylo) and one using \hrule. I'll describe them both and give an example at the end The \rule command constructs a box, which is treated ...
user avatar
  • 10.4k
73 votes

Vertical table lines are discontinuous with booktabs

I don't think the answer "Don't use vertical rules" is very constructive when the question is about making vertical lines look nice. So here is a solution if you only want to modify the width of ...
user avatar
  • 859
29 votes
Accepted

How to change a thickness of a hrule?

The latex syntax is \rule not \hrule but if you want to use \hrule then \hrule height 2cm should work. The latex syntax would be \begin{center} \rule{\textwidth}{2cm} \end{center}
user avatar
27 votes
Accepted

Changing width of table lines

Update Use \arrayrulewidth from the preamble and place it before the desired table using a group to keep the change to \arrayrulewidth local: \documentclass[11pt]{article} \usepackage{array} \begin{...
user avatar
24 votes
Accepted

Misplaced \noalign \hline

Use \hrulefill outside tabular environment for horizontal line and for a constant space in a table column, give it in the declaration line as follows: \documentclass{article} \usepackage{hyperref} \...
user avatar
21 votes
Accepted

Overline thickness

TeX The default rule thickness θ is 0.4pt in TeX. An \overline formula is set as \vbox: At the top is a kern of θ The bar follows with thickness θ The gap to the formula has height ...
user avatar
18 votes

Vertical table lines are discontinuous with booktabs

As @Puck says in his answer, and as Brandon Kuczenski comments, the responses here are not constructive, neither the question is answered. The way to use vertical lines with booktabs (despite it is ...
user avatar
18 votes
Accepted

Very slight discontinuities in table borders

This is fixed with the use of the array package: \documentclass{article} \usepackage{array} \begin{document} \begin{tabular}{|c|c|} \hline A & B \\ \hline C & D \\ \...
user avatar
  • 565k
18 votes

Showing how to solve an equation in LaTeX

Here's a solution that uses an array environment and takes care to preserve the appropriate amounts of spacing around operators of type mathbin ("+" and "-") and mathrel ("="). It also uses the macro \...
user avatar
  • 435k
17 votes
Accepted

Redefining \toprule to default line thickness to use in tables

I assume that if you want to change the width of \toprule, you also want to change the width of \bottomrule. If that's the case, just issue the instruction \setlength\heavyrulewidth{0.25ex} in the ...
user avatar
  • 435k
17 votes

vertical and horizontal line in a matrix

You could use an array instead; in this way, the standard | for the vertical rule and \hline (for the horizontal rule) will give you the desired result. The brackets can be obtained using \mleft, \...
user avatar
16 votes
Accepted

LyX command(s) to insert WYSIWYG horizontal line, for keyboard shortcut

Go to View > Messages Pane: Then click on the "Settings" tab in the bottom right corner: Then click on the "Selected" radio button: Then double click on "User commands" so that "no" turns to "yes": ...
user avatar
  • 12.4k
16 votes

Adding vertical line (equal sign) to augmented bmatrix WITHOUT using array

No, you have to use array, because the amsmath matrix environments don't provide for specifying rules. \left[\begin{array}{@{}ccc|c@{}} 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 &...
user avatar
  • 985k
15 votes

How to use booktabs in REVTex4 / REVTex4-1

Update This answer addresses a workaround for revtex4-1 which is not needed with current releases (revtex4-2) booktabs sets the default widths in a font dependent way (em units) but it seems that ...
user avatar
14 votes

Is it normal for BibTeX to replace similar author names with "------"?

All of these solutions didn't work for me so I found a simple solution: just add \vspace{0mm} to some part of the name of the author and it's OK.
user avatar
  • 141
14 votes

How to create vertical and horizontal dotted lines in a matrix?

You can adjust the dash and gap of the \hdashline by modifying the lengths \dashlinedash and \dashlinegap: \documentclass{article} \usepackage{tabularx} \usepackage{arydshln,leftidx,mathtools} \...
user avatar
  • 565k
13 votes
Accepted

leave gap before and after \hrule

Try to avoid using \\ just end the paragraph and add space: aaaaa \vspace{1cm} \hrule \vspace{1cm} aaaaaaa If you want a spaced out line.
user avatar
13 votes

Colored horizontal line between two texts

Very simply (don't forget \noindent if it's between paragraphs): \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[x11names]{xcolor} \usepackage{lipsum} \usepackage[...
user avatar
  • 259k
13 votes
Accepted

How can I draw a vertical line on a slide in beamer without affecting the positions of any other elements on the page?

You can use \vrule. Here's an example with fake images, replace them with yours. \documentclass{beamer} \usepackage{graphicx} \begin{document} \begin{frame} \frametitle{Foo Bar} \includegraphics[...
user avatar
13 votes
Accepted

Booktabs table, multicolumn header underline

Use the \cline equivalent offered by booktabs: \documentclass{article} \usepackage{booktabs} \begin{document} \begin{table} \centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}% \begin{...
user avatar
  • 565k
13 votes
Accepted

How to change hline thickness in tabular?

You can define your own \thickhline which is based on \hline, but with a different \arrayrulewidth: \documentclass{article} \makeatletter \def\thickhline{% \noalign{\ifnum0=`}\fi\hrule \@height \...
user avatar
  • 565k
12 votes

How to make continuous (but breakable) vertical rule along left side of paragraph?

Another LaTeX solution. tcolorbox is your friend (with its xparse library, the two optional arguments can be handled easily): The code (adjust the settings according to your needs): \documentclass{...
user avatar
12 votes
Accepted

Change Color, Pitch, Line Style of Showframe (Geometry Package)

Compile and read this MWE: \documentclass[a4paper]{scrartcl} \usepackage{xcolor} \usepackage[showframe]{geometry} \usepackage{microtype} \usepackage{lipsum} \makeatletter \def\Gm@hrule{\color{red!20}...
user avatar
  • 73k
12 votes
Accepted

How to create vertical and horizontal dotted lines in a matrix?

Since revtex4 seems to be incompatible with the arydshln package, here's an option using TikZ: \documentclass[aps,prl,twocolumn,nofootinbib,superscriptaddress,floatfix]{revtex4} \usepackage{tikz} \...
user avatar
12 votes

Colored horizontal line between two texts

The following example defines \sepline that prints a colored line between paragraphs, if the end of the first and the start of the second paragraph are on the same page. The line vanishes at page ...
user avatar
12 votes
Accepted

How do I make a long underscore in Plain TeX?

Use a negative height and a slightly bigger depth: \vrule height -3pt depth 3.4pt width 7cm Adjust to suit. The same idea can be used for “raised rules” (with a negative depth). No rule will appear ...
user avatar
  • 985k
12 votes

Showing how to solve an equation in LaTeX

Easy enough: use aligned: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation*} \begin{aligned} x + 2 &= 3\\ % First equation -2 &= -2\\ % Second equation \hline x ...
user avatar
  • 985k
12 votes
Accepted

Why does a \hrule need text around it to be drawn?

\hrule is a "primitive" instruction. The natural or default width of the rule drawn by this instruction is the width of the vertical box that encloses the \hrule instruction (see chap. 21 of the ...
user avatar
  • 435k

Only top scored, non community-wiki answers of a minimum length are eligible