You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I like to produce Jupyter documents out of my revealjs presentations so that my students can experiment with the code.
However, when placing a code block in a columns environment, the revealjs HTML is just fine, but not the Jupyter output. The code ends up in a text cell, rather than a code cell.
Is this the intended behaviour? Is there a workaround besides not using the columns environment?
In the example below, the HTML produced is fine for both slides, i.e. without and with columns. However, when producing a Jupyter notebook, the code on the first slide is correctly inserted into a code cell, but not the second one, which ends up in a text cell.
---title: "Python, columns, and Jupter output"format:
revealjs:
chalkboard: truemultiplex: truepreview-links: autoslide-number: truetransition: fadeipynb: default---## Sigmoid```{python}#| echo: true#| eval: true#| code-fold: true#| fig-align: centerimport numpy as npimport matplotlib.pyplot as plt# Sigmoid functiondef sigmoid(x): return 1 / (1 + np.exp(-x))# Generate x valuesx = np.linspace(-10, 10, 400)# Compute y values for the sigmoid functiony = sigmoid(x)plt.figure(figsize=(4,3))plt.plot(x, y, color='black', linewidth=2)plt.grid(True)plt.show()plt.show()```$$\sigma(t) = \frac{1}{1 + e^{-t}}$$## Hyperbolic Tangent Function
:::: {.columns}
::: {.column width="50%"}
```{python}#| echo: true#| eval: true#| code-fold: true#| fig-align: center# Compute y values for the hyperbolic tangent functiony = np.tanh(x)plt.figure(figsize=(4,3))plt.plot(x, y, color='black', linewidth=2)plt.grid(True)plt.show()```
:::
::: {.column width="50%"}
$$\tanh(t) = 2 \sigma(2t) - 1$$
:::
::::
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Hi,
I like to produce Jupyter documents out of my revealjs presentations so that my students can experiment with the code.
However, when placing a code block in a columns environment, the revealjs HTML is just fine, but not the Jupyter output. The code ends up in a text cell, rather than a code cell.
Is this the intended behaviour? Is there a workaround besides not using the columns environment?
In the example below, the HTML produced is fine for both slides, i.e. without and with columns. However, when producing a Jupyter notebook, the code on the first slide is correctly inserted into a code cell, but not the second one, which ends up in a text cell.
Thank you for your help, and time!
Marcel
Beta Was this translation helpful? Give feedback.
All reactions