Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support rendering from file #3

Open
koppor opened this issue Mar 8, 2018 · 1 comment
Open

Support rendering from file #3

koppor opened this issue Mar 8, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@koppor
Copy link
Owner

koppor commented Mar 8, 2018

See minted and listings for an inspiration

@koppor koppor added the enhancement New feature or request label Mar 8, 2018
@vivi90
Copy link

vivi90 commented Sep 10, 2022

Here is an dirty hack from StackExchange:

\documentclass{scrartcl}
\usepackage{plantuml}

\NewDocumentCommand{\includeplantuml}{m}{%
  \directlua{
    local jobname=\luastring{#1}
      local plantUmlMode=\luastring{\PlantUmlMode}
      local plantUmlSourceFilename = jobname .. "-plantuml.txt"
          infile = io.open(jobname, "r")
          instr = infile:read("*a")
          infile:close()
          outfile = io.open(plantUmlSourceFilename, "w")
          outfile:write(instr)
          outfile:close()
      require("plantuml.lua")
      convertPlantUmlToTikz(jobname, plantUmlMode)
    }
  \ifthenelse{\equal{\PlantUmlMode}{latex}}{
    \begin{adjustbox}{max width=\linewidth}
      \input{#1-plantuml.latex}
    \end{adjustbox}
  }{
    \includegraphics[width=\maxwidth{\textwidth}]{#1-plantuml.\PlantUmlMode}
  }
}


\begin{document}
\includeplantuml{plantuml-file.puml}
\end{document}

But it doen't work for me..

\includeplantuml{abbildungen/uml/ann-general-model-architecture.puml}

produces:

! LaTeX Error: File `abbildungen/uml/ann-general-model-architecture.puml-plantuml.latex' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: latex)

Enter file name: 
inhalt/hauptteil.tex:177: Emergency stop.
<read *> 
         
l.177 .../uml/ann-general-model-architecture.puml}
                                                  ^^M
inhalt/hauptteil.tex:177:  ==> Fatal error occurred, no output PDF file produced!
Transcript written on thesis.log.
...
Latexmk: Missing input file 'abbildungen/uml/ann-general-model-architecture.puml-plantuml.latex' (or dependence on it) from following:
  '! LaTeX Error: File `abbildungen/uml/ann-general-model-architecture.puml-plantuml.latex' not found.'
...

Seems like this hack doen't work with PlantUML files in subdirectories. 🤔

EDIT:
Sorry, it was my fault.
Used the wrong compiler settings. 🤣
So with this compiler settings it not works now! 🎉

{
      "command": "latexmk",
      "args": [
        "-shell-escape",
        "-synctex=1",
        "-interaction=nonstopmode",
        "-file-line-error",
        "-lualatex",
        "-outdir=%OUTDIR%",
        "%DOC%"
      ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants