Print Latex/Greek-Chars to Commandline
    조회 수: 81 (최근 30일)
  
       이전 댓글 표시
    
Is it possible to fprintf a string to commandline which includes latex characters (I know its possible on figures etc).
The below snippet doesn't work but maybe there's a clever workaround?
a = 45; fprintf(['\lambda=',num2str(a)])
Daniel below mentions a possible HTML to LaTeX workaround - does anyone have a solution in this vain?
댓글 수: 1
  Pietro
 2015년 12월 12일
				Hi, sorry i'm a kinda late :). However i was looking for an answer to the same question and (since Matlab supports HTML code) i tried typing the following lines:
charlambda=char(955); %HTML numeric entity for lambda
a=45;
lambda_string=[num2str(charlambda),' = ', num2str(a),'\n'];sprintf(lambda_string)
채택된 답변
추가 답변 (1개)
  Daniel Shub
      
      
 2013년 7월 25일
        Yes and no. The commandline does not have a LaTeX interpreter so so you cannot pass it LaTeX code. The commandline does handle HTML so if you can go from LaTeX to HTML you can get there. For your case the workaround is simplier:
a = 45; fprintf(['λ=',num2str(a), '\n'])
댓글 수: 9
  Mehmet Mahmudoglu
 2016년 11월 24일
				
      편집: Mehmet Mahmudoglu
 2016년 11월 24일
  
			This code only works for command line but not from m file if you use it in m file you have to use
a = 45; fprintf([num2str(char(955)),' = ',num2str(a), '\n'])
참고 항목
카테고리
				Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





