Mathematica中文论坛-非官方

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 9759|回复: 0
打印 上一主题 下一主题

matlab latex String must have valid interpreter syntax:

[复制链接]

532

主题

603

帖子

3035

积分

论坛元老

Rank: 8Rank: 8

积分
3035
跳转到指定楼层
楼主
发表于 2016-3-2 22:17:42 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 meatball1982 于 2016-3-2 22:19 编辑

回答别人的问题.研究了点东西.
用latex 作为字符的输出.如果里面有\text 会出错.
因为matlab不认\text
这是一个在latex 的$$环境当中写字符的东西.
几个选择,
1把字符拿出$$环境.
2.用\mbox而不是\text
3.出错,给warning ,但不是你要的结果.


  1. <blockquote>
复制代码


  1. function showLatex(str)
  2. % if ~ischar(str)
  3. %    disp('You input must be a char.');
  4. %    return;
  5. % else
  6.    h=figure('Name','VLatex Display','NumberTitle','off','menubar','none',...
  7.       'Toolbar','none','position',[520 550 600 200]);
  8.    color=get(h,'color');
  9.    ha=axes('parent',h,'xColor',color,'YColor',color,'Color',color,...
  10.       'position',[0,0,1,1]);
  11.    text('string',str,'interpreter','Latex','fontsize',14,'position',[0,0.5]);
  12. % end
复制代码

  1. clear all
  2. clc
  3. close all

  4. str1='str1:$C_s^{ADS}$(z)';
  5. str2='str2:$C_s^{ADS}(\mbox{z})

  6. ;
  7. str3='str3:$C_s^{ADS}\text(z)

  8. ;

  9. showLatex(str1)
  10. showLatex(str2)
  11. showLatex(str3)
复制代码



分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|Mathematica中文论坛-非官方 ( 辽ICP备16001491号-1

GMT+8, 2024-4-30 23:12 , Processed in 0.126587 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表