How can I make an Horizontal tab (\t) using TEXT and TeX ?

I manage to display 2 lines in bold as follows:
str =sprintf('{\\bfline1:} \n {\\bfline2:}')
text(0.2,0.3, str)
But if I replace \n (new line) by \t (horizontal tab) :
str =sprintf('{\\bfline1:} \t {\\bfline2:}')
text(0.2,0.3, str)
I get an empty square box. How can I tell MATLAB to interpret \t as an escape character? I am looking for a solution using \t if possible ant not a workaroung using char(a number) or making myself the corresponding spaces ;)

댓글 수: 1

Sean de Wolski
Sean de Wolski 2012년 9월 11일
편집: Sean de Wolski 2012년 9월 11일
I get a horizontal tab... Windows7 - 12a

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

답변 (2개)

per isakson
per isakson 2012년 9월 11일

0 개 추천

I cannot reproduce your problem. Your code works as expected here, R2012a,64bit,Win7.

댓글 수: 1

All of us in my office can reproduce the issue in R2011b, R2012a and the new R2012b under Windows XP.
str =sprintf('{\\bfline1:} \t {\\bfline2:}')
text(0.2,0.3, str)
only works for us under LInux 11b
Thanks for your attempts

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

Aurelien Queffurust
Aurelien Queffurust 2012년 9월 20일

0 개 추천

I submitted a Service request to The MathWorks Technical Support. This is their answer :
I understand that '\t' is not recognized as a horizontal tab in your code. I was able to reproduce this issue at my end on a windows XP machine.It works as expected on Windows 7. It seems like a bug and I will forward your use case to our Development Team and they will consider to address it in the future release of MATLAB. As a work around as you had suggested on MATLAB answers you can use char(a particular number) or empty spaces. I apologize for the inconvenience.

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품

질문:

2012년 9월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by