Centering Multiline Latex (in Title)

  • Follow


I have a two-line title that I want in latex where the second line is much longer than the first line.  I want to center my first line OVER THE SECOND LINE, not just center my two-line title over the graph.

I've tried title('first line','second line','Interpreter','latex','HorizontalAlignment','center'), but this centers my two-line title over the graph.

I've tried S=char('first line','second line') and then T = strjust(S, 'center') and then title(T,'Interpreter','latex') and this does the same thing as the previous attempt.

I've tried title('\begin{center} first line \\ second line \end{center}','Interpreter','latex') to no avail.

Help would be greatly appreciated because my OCD tendencies will keep me up all night until I figure it out, regardless how trivial it may be.
0
Reply Ashley 4/15/2010 4:20:19 AM

In article <hq6463$ovs$1@fred.mathworks.com>,
 "Ashley " <mill4864@umn.edu> wrote:

> I have a two-line title that I want in latex where the second line is much 
> longer than the first line.  I want to center my first line OVER THE SECOND 
> LINE, not just center my two-line title over the graph.
> 
> I've tried title('first line','second 
> line','Interpreter','latex','HorizontalAlignment','center'), but this centers 
> my two-line title over the graph.
> 
> I've tried S=char('first line','second line') and then T = strjust(S, 
> 'center') and then title(T,'Interpreter','latex') and this does the same 
> thing as the previous attempt.
> 
> I've tried title('\begin{center} first line \\ second line 
> \end{center}','Interpreter','latex') to no avail.
> 
> Help would be greatly appreciated because my OCD tendencies will keep me up 
> all night until I figure it out, regardless how trivial it may be.

Ashley,

Try this:

title({'\makebox[4in][c]{text}','\makebox[4in][c]{longer text}'},...
    'Interpreter','latex')

The trick is to make the box wide enough for the longer text and then 
make the other one the same length.

-- 
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.
0
Reply Doug 4/15/2010 5:07:40 AM


:O  It worked !!!

Thank you so much, that was brilliant
0
Reply Ashley 4/15/2010 5:27:05 AM

2 Replies
749 Views

(page loaded in 0.104 seconds)

Similiar Articles:













7/24/2012 8:14:56 PM


Reply: