diff --git a/book/basic-features/figures.md b/book/basic-features/figures.md index 8578324..f03c81e 100644 --- a/book/basic-features/figures.md +++ b/book/basic-features/figures.md @@ -2,15 +2,137 @@ To add a figure, just copy the figure to the correct directory. Then, in your markdown file, include the figure as follows: +```` ```{figure} .png/.jpg --- height/width: name: + align: left / center / right + figclass: left blank or "margin" ---
``` +```` -Or you can use the figure form below where you can specify all information and the code is produced for you: +For example: + +```` + ```{figure} ../images/TUDelft_logo_rgb.png + --- + width: 70% + name: demoexample1 + align: center + --- + example 1: width (70%) as percentage, align center + ``` +```` + +provides this output, which looks nice. +```{figure} ../images/TUDelft_logo_rgb.png +--- +width: 70% +name: demoexample1 +align: center +--- +example 1: width (70%) as percentage, align center +``` + +Using the name label, you can refer to the figure as done with {numref}`Figure {number} `. + +You can find more documentation on including figures [here](https://jupyterbook.org/en/stable/content/figures.html).
+ +There are many settings, for instance aligning right: + +```` + ```{figure} ../images/TUDelft_logo_rgb.png + --- + width: 50% + name: demoexample2 + align: right + --- + example 2: width (50%) as percentage, align right + ``` +```` + +provides the output: + +```{figure} ../images/TUDelft_logo_rgb.png +--- +width: 50% +name: demoexample2 +align: right +--- +example 2: width (50%) as percentage, align right +``` + +Aligning right can come with the potential downside (not always wanted) that text is wrapped around the figure. To avoid this one can use `
` elements, both before and after the text (make sure to leave an empty line after the `
`!): + +```` +
+ and the output +
+
+ + ```{figure} ../images/TUDelft_logo_rgb.png + --- + width: 50% + name: demoexample3 + align: right + --- + example 3: width (50%) as percentage, align right with additional div style + ``` + +
+```` + +
+with the result: +
+ +
+ +```{figure} ../images/TUDelft_logo_rgb.png +--- +width: 50% +name: demoexample3 +align: right +--- +example 3: width (50%) as percentage, align right with additional div style +``` + +
+ +
+ +including `figclass: margin` sets the figure to the column at the right. + +
+ +```` + ```{figure} demo97/demo97_figure1.jpg + --- + figclass: margin + width: 50% + name: demoexample2 + + --- + example 2:including figclass: margin + ``` +```` + +
+ +```{figure} ../images/TUDelft_logo_rgb.png +--- +figclass: margin +width: 50% +name: demoexample4 +--- +example 4:including figclass: margin +``` + +## Figure syntax maker +One might quickely forget the code for making figures, here is a useful tool to make your figures, just specify all information and the code is produced for you:
@@ -19,6 +141,3 @@ Or you can use the figure form below where you can specify all information and t
- -You can find more documentation on including figures [here](https://jupyterbook.org/en/stable/content/figures.html). -