1# latexcaption plugin for DokuWiki 2 3Adds syntax for latex-like figure captions and numbering 4 5All documentation for this plugin can be found at 6https://github.com/bennvan/dokuwiki-plugin-latexcaption 7 8 9Originally forked from Till Biskup and mostly re-written. New repo due to change in syntax. 10https://github.com/tillbiskup/dokuwiki-caption 11 12 13Fixes: 14- No string searches to set reference links that appear before a label definition. 15- Change syntax to allow multiple classes to be used eg. left, center, right. 16- Add ability to have subfigures/tables. 17- Add option to change caption tag syntax. 18- Code easy to expand to caption label more tags if needed. 19- Updated some css styles to use flexbox. 20 21The following outputs are using the bootstrap3 template. Please note that the `<caption></caption>` syntax conflicts with bootstraps' caption. I recommend to modify the boostrap3 syntax to use something like `<bscaption></bscaption>`, or alternatively I have provided a setting to change the syntax of this plugin. 22 23Example output: 24------------- 25 26![Example output](example.png "output of Example") 27 28 29New Syntax/ Example: 30------------- 31 32 - Currently supported blocks to caption are: `figure`, `subfigure`, `table`, `subtable`, `codeblock`, `fileblock`. 33 34``` 35<figure opts| fig_label> 36 <subfigure opts| subfig_label1> 37 {{image1.jpg?direct&200}} 38 <caption>Subfig caption1</caption> 39 </subfigure> 40 <subfigure opts| subfig_label2> 41 {{image2.jpg?direct&200}} 42 <caption>Subfig caption2</caption> 43 </subfigure> 44 <caption>Main caption</caption> 45</figure> 46``` 47 48Options: 49------------ 50 51 - Alignment classes: `left`, `center`, `right`, `even`,`w-[40,50,60,70,80]` and can be used in conjunction with optional media queries (`-sm`, `-md`, `-lg`, `-xl`) eg. `right-sm w-80-sm`. `even` may only be used with figures. 52 - No colon: `blank`. Use this if you dont want to print a ':' after the figure number. 53 54If you want to apply your own css stying to the figures. Any option input are added as a class in the form `plugin_latexcaption_{option}`. 55 56 57Example with centering and caption number only: 58 59``` 60<figure center blank> 61 {{image1.jpg?direct&200}} 62 <caption></caption> 63</figure> 64``` 65 66Example subfigure with a long caption: 67``` 68<figure center> 69 <subfigure> 70 {{image1.jpg?direct&200}} 71 <caption>A really long subfigure caption much longer than the image that needs to wrap</caption> 72 </subfigure> 73 <subfigure> 74 {{image2.jpg?direct&200}} 75 <caption>A moderately sized subfigure caption</caption> 76 </subfigure> 77 <caption>Main caption</caption> 78</figure> 79``` 80 81This gives the output: 82 83![Example output2](example2.png "output of Example2") 84 85 86It is also possible to have more than one image in a figure/subfigure to group them with one caption: 87``` 88<figure center> 89 {{image1.jpg?direct&200}} 90 {{image2.jpg?direct&200}} 91 <caption>A caption</caption> 92</figure> 93``` 94 95In text referencing: 96------------- 97``` 98{{ref>label}} 99``` 100Warning: References may render unexpected results if your labels are not unique across all figures, subfigures, tables etc.! 101 102Set counter: 103------------- 104 105You can set the counter to any integer value at any point on the page. 106 107``` 108<!-- Set the figure counter to 5 --> 109{{setcounter>figure=5}} 110 111<!-- Set the table counter to 3 --> 112{{setcounter>table=3}} 113``` 114 115----- 116 117If you install this plugin manually, make sure it is installed in 118lib/plugins/latexcaption/ - if the folder is called different it 119will not work! 120 121Please refer to http://www.dokuwiki.org/extensions for additional info 122on how to install extensions in DokuWiki. 123 124---- 125Copyright (C) Ben van Magill <ben.vanmagill16@gmail.com> 126 127This program is free software; you can redistribute it and/or modify 128it under the terms of the GNU General Public License as published by 129the Free Software Foundation; version 2 of the License 130 131This program is distributed in the hope that it will be useful, 132but WITHOUT ANY WARRANTY; without even the implied warranty of 133MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 134GNU General Public License for more details. 135 136See the LICENSING file for details 137