필터 지우기
필터 지우기

How can to add a line break in Latex?

조회 수: 109 (최근 30일)
Frits
Frits 2011년 6월 27일
댓글: Richard 2023년 7월 4일
LS,
I would like to make a line break within an Latex equation. The command
\newline
in the next code is not working:
text('Position',PosOne, 'interpreter','latex', 'string','$$\ a= \newline \frac{b}{c} $$');
Can anyone tell me what I'm doing wrong? Your help is appreciated a lot.
Best regards,
Frits

채택된 답변

Jan
Jan 2011년 6월 27일
text(0.5, 0.5, ...
'string', {'$$a=$$', '$$\ \frac{b}{c}$$'}, ...
'interpreter', 'latex');
or:
text(0.5, 0.5, ...
'string', ['$$a=$$', char(10), '$$\ \frac{b}{c}$$'], ...
'interpreter', 'latex');
  댓글 수: 3
Carlo Bianchi
Carlo Bianchi 2017년 6월 22일
Hi, I found this old post and I have a similar problem. Did you solve yours? How can I have 2 lines with the latex interpreter and have the centra alignment at the same time?
Richard
Richard 2023년 7월 4일
Hello, the multiline in text() can be done by making cell array (of chars or strings), or string array from the desired text. For example:
text(0.5, 0.1, {'$$a=$$', '$$\ \frac{b}{c}$$'},'interpreter', 'latex');
or
text(0.5, 0.4, ["$$a=$$", "$$\ \frac{b}{c}$$"],'interpreter', 'latex');
Will generate "a=", "newline","b/c", while char array will just connect the letters, without any "newline":
text(0.5, 0.7, ['$$a=$$', '$$\ \frac{b}{c}$$'],'interpreter', 'latex');

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 LaTeX에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by