필터 지우기
필터 지우기

Centering multiline text with the LaTeX interpreter

조회 수: 6 (최근 30일)
Juliette Salexa
Juliette Salexa 2012년 8월 28일
To get two-line text on a figure I have to do:
uicontrol('Style','text','Position',[14, -1000,0], 'String',{'line 1','Longer line 2'});
However, if I want the strings to be interpreted by LaTeX, I'd first try:
uicontrol('Style','text','Position',[14, -1000,0], 'String',{'line 1','Longer line 2'}, 'HorizontalAlignment', 'left', 'Interpreter','Latex','FontSize',36);
But the MATLAB doesn't like the interpreter command.
But
text(14, -1000, {'\makebox[4in][c]{text}','\makebox[4in][c]{longer text}'}, 'HorizontalAlignment', 'left', 'Interpreter','Latex','FontSize',36);
Does not produce any text on the figure !
Does anyone know how to get 2 lines of centered text on a figure while being interpreted by LaTeX ?

답변 (1개)

Walter Roberson
Walter Roberson 2012년 8월 28일
When that command is given by itself, the position (14,-1000) is outside of the graph limits, so nothing shows up.
If you change to (0,0) for testing purposes, then further experimentation shows that the graph will show up if you change to (e.g.) 4cm rather than 4in .

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by