Most Popular

1500 questions
354
votes
17 answers

Forcing linebreaks in \url

This question led to a new package: xurl I wish to typeset some relatively long URLs in a piece of text, and when I use \url{..}, the resulting text does not respect the margin boundaries that govern the main text body, instead going all the way…
Suresh
  • 16,511
  • 14
  • 55
  • 64
353
votes
10 answers

How can I split an equation over two (or more) lines

I am having the following equation: \begin{equation} Q(\lambda,\hat{\lambda}) = -\frac{1}{2} P(O \mid \lambda ) \sum_s \sum_m \sum_t \gamma_m^{(s)} (t) \left( n \log(2 \pi ) + \log \left| C_m^{(s)} \right| + \left( \mathbf{o}_t - \hat{\mu}_m^{(s)}…
Peter Smit
  • 14,035
353
votes
6 answers

BibTeX loses capitals when creating .bbl file

Titles of articles I'm about to cite contain upper case letters and when using BibTeX it converts them to lower case ones. This happens only in the title and only the first letter conserves its case. For example, when I cite an article about HF, the…
Crowley
  • 4,297
352
votes
4 answers

How to change color for a block of texts?

I am editing a LaTeX paper with Emacs. Sometimes I want to make a block of texts less obvious (or less important to see). Instead of totally hiding them, they should still be there. Is there an easy way to embed them in something so that it changes…
SoftTimur
  • 19,767
350
votes
10 answers

What's the quickest way to write "2nd" "3rd" etc in LaTeX?

If I want to use abbreviations for second, third and so on in my LaTeX documents, I am currently doing this: 2$^{nd}$ which seems unsatisfactory. Is there a macro I'm missing? I'm sure I could define one myself, and it would be fairly easy. But this…
Seamus
  • 73,242
346
votes
7 answers

Multi-line (block) comments in LaTeX

In LaTeX, % can be used for single-line comments. For multi-line comments, the following command is available in the verbatim package. \begin{comment} Commented code \end{comment} But is there a simple command like /* code */ in C?
Arindam Pal
  • 3,821
344
votes
10 answers

How to add todo notes?

Is there a simple way to add todo notes to LaTeX documents ? I would like to have these notes in red in the generated pdf and a simple syntax to write them.
aneuryzm
  • 4,901
342
votes
4 answers

Create xkcd style diagram in TeX

The unique style of the diagrams at xkcd has an informative but nice hand-drawn touch. I guess they are actually drawn by hand but just recently on our partner site for Mathematica someone asked how to draw a similar diagram such as this one with…
Alexander
  • 9,163
341
votes
5 answers

What is the difference between Fragile and Robust commands? When and why do we need \protect?

So I've read a few times about this, the “moving arguments” and all that. But what does it really mean? Could someone explain in a few words what is going on at the TeX level, what is the difference between fragile and robust commands? Furthermore,…
Juan A. Navarro
  • 62,139
  • 32
  • 140
  • 169
334
votes
3 answers

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}
yannisl
  • 117,160
333
votes
7 answers

Dashes: - vs. – vs. —

This may or may not be a real TeX/LaTeX question but rather a general question on punctuation: How are the different dashes - "-", -- "–" and --- "—" supposed to be used?
Kevin H. Lin
  • 3,433
331
votes
11 answers

How to install "vanilla" TeXLive on Debian or Ubuntu?

Debian and Ubuntu have very good texlive packaging. But I'd like to use tlmgr to have a more fine-grained control about upgrades and which packages I want to be installed. So how do I install "vanilla" TeXLive on Debian/Ubuntu? Also how do I make…
Dima
  • 12,427
  • 8
  • 40
  • 53
328
votes
7 answers

Correctly scaling a tikzpicture

I was wondering which is the correct way to scale a tikzpicture. I tried with \begin{tikzpicture}[scale=0.50] but what I obtain is that distances between elements are scaled but not their sizes or text size too. It's like if the picture collapses…
Jack
  • 3,383
328
votes
13 answers

Using \footnote in a figure's \caption

Maybe this is an easy one, but I struggled with this now too long :) I want to have a footnote in a caption of a figure, see the example. \begin{figure}[!ht] \caption{a figure caption\footnote{where i got it from}} \label{somelabel} …
Matten
  • 5,687
327
votes
5 answers

Crop an inserted image?

I'm inserting an image with a simple: \includegraphics[height=5cm]{filename.png} This results in an image that maintains the aspect ratio, and so gives me something like 6cm width. I only really want the left side of the image though, and would…
naught101
  • 8,224