Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manually output publishing content from a variable

When using the Publish feature of MATLAB, it typically publishes only what comes after the % signs or the function output. However, is there any command to take a variable and splice its value into text, possibly even creating LaTeX formulae from a MATLAB variable that holds a character string?

like image 639
Dmitri Nesteruk Avatar asked Sep 30 '14 14:09

Dmitri Nesteruk


People also ask

How do I publish a pub/sub message?

Using ordering keys 1 In the Cloud Console, go to the Pub/Sub topics page.#N#Go to the Pub/Sub topics page 2 Click the topic ID. 3 In the Topic details page, click Publish messages. 4 In the Message body field, enter the message data. 5 In the Ordering key field, enter an ordering key. 6 Click Publish. More ...

How do I publish a pubsubmessage JSON Schema in C++?

The PubsubMessage JSON schema is published as part of the REST and RPC documentation. Before trying this sample, follow the C++ setup instructions in Quickstart: Using Client Libraries . For more information, see the Pub/Sub C++ API reference documentation . auto message_id = publisher. Publish ( .

What is the difference between pub/sub and publisher application?

A publisher application creates and sends messages to a topic. Pub/Sub offers at-least-once message delivery and best-effort ordering to existing subscribers, as explained in the Subscriber Overview. The general flow for a publisher application is: Create a message containing your data.

How to publish messages asynchronously in the client libraries?

The client libraries can asynchronously publish messages. In the Cloud Console, go to the Pub/Sub topics page. Click the topic ID. In the Topic details page under Messages, click Publish message. In the Message body field, enter the message data.


Video Answer


1 Answers

Here is an example of rendering LaTeX formulae (one hard-coded in comments, other stored as a string in a variable).

%% LaTeX Examples
% Below are some equations rendered in LaTeX.
% (try to publish this file).
%

%% The definition of e
% Here we use equation embedded in the file.
%
% $$ e = \sum_{k=0}^\infty {1 \over {k!} } $$
%

%% The Laplace transform
% Here we render an equation stored in a variable.
%

% offscreen figure
fig = figure('Menubar','none', 'Color','white', ...
    'Units','inches', 'Position',[100 100 6 1.5]);
axis off

str = 'L\{f(t)\} \equiv  F(s) = \int_0^\infty\!\!{e^{-st}f(t)dt}';
text(0.5, 0.5, ['$$' str '$$'], 'Interpreter','latex', 'FontSize',28, ...
    'HorizontalAlignment','center', 'VerticalAlignment','middle')
snapnow
close(fig);

Here is how it looks like when the file is published as HTML:

published_html

You could wrap that last code in a helper function render_latex_string(str) and call it from different places.

like image 183
Amro Avatar answered Sep 23 '22 02:09

Amro