Using a citation manager in PlantUML

0 votes
asked Nov 23, 2019 in Question / help by polc1410 (160 points)

I'm trying to find out if there is a supported or suggested method of using citations within a flow diagram.  By citations I mean a reference to a published article.

Here is an 'example' flow diagram like I might want to create.  I'm abusing the "Class" to do it but I think it works for me!  I'm expecting to have several pages of much more complex diagrams with numerous references to published works.  They could be links, but links wont work in a "paper" version.

This will likely be joined together in markup or something similar so the 'References' may well simply be to the end of the document rather than a note in the UML.

Here is an example of what I'm thinking it *might* look like:

https://liveuml.com/view/5dd90899663178088afee793

title World Health Organisation Pain Ladder\n

class "Step 1" << (1,green) >> {
  Treat with simple
  analgesics first
  ..
  + Paracetamol
  + Ibuprofen
}

class "Step 2" << (2,orange) >> {
  Treat with weak
  opiates [@PrescrireInt2004]
  ..
  # [[http://bnf.org?search=codeine Codeine]]
  # [[http://bnf.org?search=dihydrocodeine Dihydrocodeine]]
  - [[http://bnf.org?search=tramadol Tramadol]]
}

class "Step 3" << (3,red) >>{
  Treat with strong
  opiates
  ..
  - Morphine
  - Fentanyl
}

"Step 1" --|> "Step 2" : uncontrolled\npain
"Step 2" --|> "Step 3" : uncontrolled\npain

class "Key" << (-,black) >> {
    + Available over the counter from pharmacy
    # Available only on prescription
    - Controlled drug
}

note as References
@PrescrireInt2004

Which obviously actually gives this:

But I'd rather have something like this:

i.e. replace the [@...] with a superscript number and then insert the full reference in the reference box.  It can possibly be done using a citation manager in the whole document before generating the diagram from the code but looking for the 'best' way to do it.

Also curious if its even possible to insert superscript numbers as couldn't find it and had to cheat a bit to generate my example.

1 Answer

0 votes
answered Nov 23, 2019 by plantuml (295,000 points)
It sounds like an interesting idea.

Probably the more difficult task is to find a nice syntax.

Could you post here an short and simple example (less than 10 lines) of the syntax you are thinking of ?

Thanks!
commented Nov 23, 2019 by polc1410 (160 points)
I'm not completely sure!

I R markdown I use bookdown which works like this:

You define your references somewhere e.g.:
@Manual{anderson2015,
  title = {Exhumation by debris flows in the 2013 Colorado Front Range storm},
  author = { S.W. Anderson and S.P. Anderson and R.S Anderson},
  journal = {Geology},
  year = {2015},
  pages = {31,94},
  url = {https://www.R-project.org/},
}

Then in the text you would cite it as @anderson2015

When marked up that would appear in the text as:

Then in the text you would cite it as [1]

And it would at the very end attach a reference section.

Depending how  the config is set affects if the [1] is like that or (1) or <sup>1</sup> or (Anderson, 2015).

I was initially thinking I'd want a reference box in the diagram. But that means for different journals etc you might need to have different formatting? That sounds too much effort.  So would be better to insert something like

[@anderson2015] in the diagram code. But before rendering the code, to have bookdown replace that with the relevant citation (e.g. <sup>37</sup> possibly hyperlinked to the reference section of the document.

So bookdown just needs to do a search and replace before rendering... I think.
commented Nov 23, 2019 by plantuml (295,000 points)
This forum is great to ask questions and to make some request.

However, to discuss and find about some new features, it has some limitations.

So we are also using another wiki http://alphadoc.plantuml.com/doc/asciidoc/en/using-a-citation-manager where you can freely write down all your though.

I suggest that we use that page: please abuse posting on http://alphadoc.plantuml.com/doc/asciidoc/en/using-a-citation-manager :-)

You can put any idea there. You cannot write anything wrong and your ideas will give ideas and suggestions to other users.
commented Nov 23, 2019 by polc1410 (160 points)
OK I'll move over there.

I'm having a little play with export to latex and getting it to do the citing.  Most of my use will be pdf so likely OK if it works.

But I as hoping to mirror output to html too...
...