TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a some data plotted with pgfplots. I would like to make the title two lines. Can this be done? I tried adding \\ in the title command but that did nothing. Additionally, I couldn't find anything in the manual.

In my axis command, I have the option title = {text \\ text} where I want to split the title.

\pgfplotsset{compat = 1.10}
\begin{axis}[title = {text \\ text}]
\addplot[smooth, samples = 100, domain = 0:2] (\x, 2);
share|improve this question
Along with describing the problem, It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. – Peter Grill May 13 '14 at 2:14
@PeterGrill I didn't really think this question needed a MWE. – dustin May 13 '14 at 2:15
Adding a MWE makes the question much clearer and eliminates the need for the person trying to help you to have to set it up and check that what they are proposing actually will work for you. I think perhaps egerg and DavidCarlisle can give you an answer without a MWE, but I don't think most others can. – Peter Grill May 13 '14 at 2:25
up vote 5 down vote accepted

Add align=center does the trick:

enter image description here


\documentclass[tikz, border=2pt]{standalone}
%\pgfplotsset{compat = 1.10}
\begin{axis}[align =center, title = {text \\ text}]
\addplot[smooth, samples = 100, domain = 0:2] (\x, 2);
share|improve this answer
Is there a way to do this with compat = 1.10? – dustin May 13 '14 at 2:24
@dustin Use \pgfplotsset{compat = 1.10, title/.append style={align =center} } – Harish Kumar May 13 '14 at 2:26
@dustin: It should work. I don't have the latest version but so I cant test it but I am pretty sure it'll work. Let me know if it doesn't. – Peter Grill May 13 '14 at 2:26
It works on 1.10. I thought maybe it wouldn't since it was commented out. – dustin May 13 '14 at 2:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.