some reorganisation, js deleted, readme updated

This commit is contained in:
Meik Hellmund 2024-05-14 14:50:59 +02:00
parent 31981a7612
commit 6d032cfbea
7 changed files with 40 additions and 104 deletions

3
.gitignore vendored
View File

@ -28,5 +28,6 @@ index.html.md
Julia*tex
xelatex.py
.luarc.json
/.luarc.json
nb/*.qmd
nb/*.ipynb

View File

@ -1,19 +1,9 @@
# Julia für Numerik
Source code for the website and PDF ["Julia für Numerik"](https://www.math.uni-leipzig.de/~hellmund/juliabook/)
Source code for the website and PDF script ["Julia für Numerik"](https://www.math.uni-leipzig.de/~hellmund/juliabook/)
- It uses the [Quarto publishing system](https://quarto.org/).
- It uses the Quarto extension [julia-color](https://gitea.math.uni-leipzig.de/hellmund/julia-color) to support
- It uses the Quarto extension [julia-color](https://github.com/MHellmund/julia-color) to support
the conversion of Jupyter code output cells with ANSI escape sequences to HTML and LaTeX/PDF
Since the `julia-color` extension needs a patched `Quarto` anyway, we use two more patches.
- `patch-quarto-julia` reduces the `startup.jl` used by quarto to a minimum.
- `patch-quarto-stacktrace` adds the julia stacktrace to the output of code cells with julia errors. See e.g. the second code cell [here](https://www.math.uni-leipzig.de/~hellmund/juliabook/chapters/syntax.html#arithmetische-vergleiche)
```shell
cd quarto-cli
patch -p1 < patch-quarto-julia
patch -p1 < patch-quarto-stacktrace
```
All content & code licenced under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).

View File

@ -2,7 +2,6 @@ project:
type: book
resources:
- fonts/
- js/
- images/
lang: de
@ -41,22 +40,22 @@ book:
chapters:
- index.qmd
- chapters/entwicklungsumgebungen.qmd
- chapters/first_contact.qmd
- chapters/Erste_Bsp.qmd
- chapters/syntax.qmd
- chapters/5_TricksHelp.qmd
- chapters/numerictypes.qmd
- chapters/Pi2.qmd
- chapters/types.qmd
- chapters/pcomplex.qmd
- chapters/9_functs.qmd
- chapters/6_ArraysEtcP1.qmd
- chapters/7_ArraysP2.qmd
- chapters/11_LinAlg.qmd
- chapters/10_Strings.qmd
# - chapters/entwicklungsumgebungen.qmd
# - chapters/first_contact.qmd
# - chapters/Erste_Bsp.qmd
# - chapters/syntax.qmd
# - chapters/5_TricksHelp.qmd
# - chapters/numerictypes.qmd
# - chapters/Pi2.qmd
# - chapters/types.qmd
# - chapters/pcomplex.qmd
# - chapters/9_functs.qmd
# - chapters/6_ArraysEtcP1.qmd
# - chapters/7_ArraysP2.qmd
# - chapters/11_LinAlg.qmd
# - chapters/10_Strings.qmd
- chapters/14_Plot.qmd
- chapters/13_IO.qmd
# - chapters/13_IO.qmd
# - chapters/makie.qmd
@ -110,7 +109,7 @@ format:
latex-auto-install: false
execute:
cache: false
cache: true
output: true
echo: true
warning: true

File diff suppressed because one or more lines are too long

8
nb/script1.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
cp ../chapters/*.quarto_ipynb .
for i in *.quarto_ipynb
do
echo $i
mv $i "${i%.quarto_ipynb}.ipynb"
jupyter nbconvert --inplace --clear-output --to notebook "${i%.quarto_ipynb}.ipynb"
done

11
nb/script2.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
# muss engine wechsln!
cp ../chapters/*.qmd .
for i in *.qmd
do
echo $i
quarto render ${i} --to ipynb --no-execute
done

View File

@ -1,65 +0,0 @@
diff --git a/src/resources/jupyter/lang/julia/setup.jl b/src/resources/jupyter/lang/julia/setup.jl
index 5d092330f..94687394f 100644
--- a/src/resources/jupyter/lang/julia/setup.jl
+++ b/src/resources/jupyter/lang/julia/setup.jl
@@ -28,30 +28,6 @@ end
fig_width = fig_width * fig_dpi
fig_height = fig_height * fig_dpi
-# Intialize Plots w/ default fig width/height
-try
- import Plots
-
- # Plots.jl doesn't support PDF output for versions < 1.28.1
- # so use png (if the DPI remains the default of 300 then set to 96)
- if (Plots._current_plots_version < v"1.28.1") & (fig_format == :pdf)
- Plots.gr(size=(fig_width, fig_height), fmt = :png, dpi = fig_dpi)
- else
- Plots.gr(size=(fig_width, fig_height), fmt = fig_format, dpi = fig_dpi)
- end
-catch e
- # @warn "Plots init" exception=(e, catch_backtrace())
-end
-
-# Initialize CairoMakie with default fig width/height
-try
- import CairoMakie
-
- CairoMakie.activate!(type = string(fig_format))
- CairoMakie.update_theme!(resolution=(fig_width, fig_height))
-catch e
- # @warn "CairoMakie init" exception=(e, catch_backtrace())
-end
# Set run_path if specified
try
@@ -71,29 +47,5 @@ function isinstalled(pkg::String)
any(x -> x.name == pkg && x.is_direct_dep, values(Pkg.dependencies()))
end
-# ojs_define
-if isinstalled("JSON") && isinstalled("DataFrames")
- import JSON, DataFrames
- global function ojs_define(; kwargs...)
- convert(x) = x
- convert(x::DataFrames.AbstractDataFrame) = Tables.rows(x)
- content = Dict("contents" => [Dict("name" => k, "value" => convert(v)) for (k, v) in kwargs])
- tag = "<script type='ojs-define'>$(JSON.json(content))</script>"
- IJulia.display(MIME("text/html"), tag)
- end
-elseif isinstalled("JSON")
- import JSON
- global function ojs_define(; kwargs...)
- content = Dict("contents" => [Dict("name" => k, "value" => v) for (k, v) in kwargs])
- tag = "<script type='ojs-define'>$(JSON.json(content))</script>"
- IJulia.display(MIME("text/html"), tag)
- end
-else
- global function ojs_define(; kwargs...)
- @warn "JSON package not available. Please install the JSON.jl package to use ojs_define."
- end
-end
-
-
# don't return kernel dependencies (b/c Revise should take care of dependencies)
nothing