COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### 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

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

:O  It worked !!!

Thank you so much, that was brilliant

 0

2 Replies
749 Views

Similiar Articles:

7/24/2012 8:14:56 PM