question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create latex output for Jupyter notebooks

See original GitHub issue

PR #276 adds latex output for transfer functions. It would be nice to add this for other LTI types as well (particularly StateSpace objects). Having the output match the text approximation in __repr__ seems like a good first cut at format to use.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:15 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
roryyorkecommented, Apr 11, 2021

Having Jupyter display the Mathjax is useful for small state spaces, but I’ve had some problems with larger ones causing Jupyter Notebook to hang. I then have to forcibly stop my browser and then reopening, hoping that I can clear all outputs before it starts rendering.

A short-term workaround is to remove the related method after importing python-control:

import control as ct
del ct.statesp.StateSpace._repr_latex_

Using display(ss) to show the Mathjax version might be more appropriate,

My understanding is that display just a way to force output of a variable, so IPython cells

a = ss(1,2,3,4);
display(a)

and

a = ss(1,2,3,4)
a

are equivalent.

A switch back to “plain old repr” for bigger systems seems like a reasonable idea. We could add a config.defaults['statesp.latex_maxsize'] and if either (nstates + ninputs) or (nstate + noutputs) > latex_maxsize, have _repr_latex_ return None. One could then set latex_maxsize to -1 to disable the LaTeX display altogether. See https://ipython.readthedocs.io/en/stable/config/integrating.html

1reaction
roryyorkecommented, Aug 9, 2020

Branch and gist updated. User can select from ‘partitioned’ and ‘separate’ types, and specify format string.

Static-gain (“stateless”) systems are special-cased.

How should configuration options be documented?

I think this should have some minimal testing, though I’ll probably use a “gold image” approach, i.e., generate reference strings using the implementation.

image

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to show `print` output as LaTeX in jupyter ...
As I wrote earlier, I am using jupyter notebook, so I can use $ operators in markdown cells to create LaTeX formulas. My...
Read more >
Learn How to Write Markdown & LaTeX in The Jupyter Notebook
Even web developers, now, use Markdown then convert it to HTML using some websites. • Headings. You make titles using hashtags # ....
Read more >
How to use Latex in Jupyter notebook - Linux Hint
One of the most popular is Jupyter Notebook that uses MathJax to render the Latex syntax inside the markdown/HTML. To use LaTeX in...
Read more >
Copy Output table in Jupyter for LaTex Document - TeX
I am able to put code onto my LaTex Document, but I wanted to know if it is possible to import my output...
Read more >
(some) LaTeX environments for Jupyter notebook
(some) LaTeX environments for Jupyter notebook¶ · support for some LaTeX commands within markdown cells, e.g. \textit , \textbf , \underline . ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found