giving inline latex same baseline as text
12 次查看(过去 30 天)
显示 更早的评论
In my comment I'm explaining that my signal is represented by e^-jwt (and in latex
) now in this text you can see that the word 'latex' and the expression have the same baseline, but when I run it in 'Publish' I get this:


As you can see the LaTeX code appears like a superscript vs having the same baseline as my other text. What am I doing wrong?
回答(2 个)
Umeshraja
2025-3-5
I understand you are encountering an alignment issue when publishing inline comments containing expressions like (e^{-j\omega t} ). To address this, consider using the LaTeX syntax ( e^{-j\omega t} ) instead of writing out "exp." Additionally, ensure that you enclose your inline LaTeX expressions within single dollar signs ($) as demonstrated below:
%
% This is an inline expression: $e^{-j\omega t}$.
%
Alternatively, could use HTML markup for better control over text alignment as shown below
% <html>This is an expression: <i>e<sup>-jωt</sup></i>.</html>

To know more, please refer to the following documentation on LaTex Equations in Publishing Markup
Hope this helps!
5 个评论
Umeshraja
2025-3-5
Removing parentheses looks much better as shown below
%% Demonstrate the Bug
%
% This is a bug (well it demonstrates the bug)
%
% the following expression, $e^{-j{\omega}t}$, is a phasor
% As you can see $\cos {\omega t} + \sin {\omega}t$ from
% the screen shot it isn't aligned correctly
% when the comment is published.
%

Umeshraja
2025-3-7
A potential workaround for your issue is to use the Live Editor (.mlx) instead of a plain script (.m). You can then export it as a PDF, which should help avoid the unusual behavior you're experiencing. I've attached a screenshot for reference, where you can see the expected output.

For more information, you might find this MATLAB Answers post helpful:
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Adding custom doc 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!