giving inline latex same baseline as text
10 views (last 30 days)
Show older comments
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?
Answers (2)
Umeshraja
on 5 Mar 2025
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 Comments
Umeshraja
on 5 Mar 2025
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
on 7 Mar 2025
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:
See Also
Categories
Find more on Adding custom doc in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!