我在MATLAB中画了一个图,标题很长,所以我决定把它分成两行。但是,当我使用LaTeX解释器时,它不起作用。
标题代码行如下所示:
title('{Monte-Carlo For Both Linear and Non-Linear Models Using N=300 and An Adjoint Simulation;Frequency = 100Hz $\sigma_{T}=\sigma_{D}=10^{-5}$}','Interpreter','latex')我如何使它出现在2行,但以LaTeX字体显示?
发布于 2017-11-02 22:15:11
将字符串分解成一个单元阵列似乎很好:
title({'Monte-Carlo For Both Linear and Non-Linear Models Using N=300' ...
'and An Adjoint Simulation; Frequency = 100Hz $\sigma_{T}=\sigma_{D}=10^{-5}$'}, ...
'Interpreter', 'latex');下面是它的样子:

这将导致左-证明每一行都是合理的。如果您需要它们,那么最简单的方法可能是使用环境,就像沃纳所建议的那样。
title(['\begin{tabular}{c} Monte-Carlo For Both Linear and Non-Linear ' ...
'Models Using N=300 \\ and An Adjoint Simulation; Frequency = 100Hz ' ...
'$\sigma_{T}=\sigma_{D}=10^{-5}$ \end{tabular}'], ...
'Interpreter', 'latex');如果您发现自己主要是处理数学方程,而很少或没有文本,那么matrix可能更好(如果需要的话,使用\textrm{...}可以转义文本):
title('$\matrix{\textrm{Some text} \cr \sigma_{T}=\sigma_{D}=10^{-5}}$', ...
'Interpreter', 'latex');发布于 2019-12-19 20:18:03
你可以这样写:
title({['best solution: ' num2str(1)]...
[' Cost: ' num2str(20)]})通过使用{},您可以将标题写成几行。注意,通过使用[],您可以在同一行中写入。

https://stackoverflow.com/questions/47085142
复制相似问题