User1291 - 1 year ago 180
LaTeX Question

# Freeplane - latexinput

So I've tried to find a mind-mapping software with latex support and stumbled across Freeplane.

Pretty satisfied with it, except I cannot seem to figure out how to make latex input from file work.

E.g. if I want to include a code like this:

\textbf{$Alg_0$}
\begin{tabular}{cl}
0 & \text{initialisation of $Alg_0$} \\
1 & \text{do\ some\ first\ step}\\
2 & \text{...} \\
\end{tabular}


I can copy this to the node and the rendered result looks as expected (though the need for the
\text{}
is annoying).

Now for sake of easier writing/modification, I should like to not have to copy it into Freeplane every time.

Freeplane claims that's possible, with the
\latexinput{}
command but "the file must be a well-formed XML document, so you must have a root tag and escape <, > and &"

Following their example, I add doc tags and escape &:

<doc>
\textbf{$Alg_0$}
\begin{tabular}{cl}
0 &amp; \text{initialisation of $Alg_0$} \\
1 &amp; \text{do\ some\ first\ step}\\
2 &amp; \text{...} \\
\end{tabular}
<doc>


save this as
alg_0.xml
in the same folder I've put the
.mm
file and create a node with

\latexinput{alg_0.xml}


Changing its format to LaTeX will now display:

Error setting the text for the following input: \latexinput{alg_0.xml}.

How do I resolve this?

quick answer: You probably do not want \latexinput{...} which only works for exports.

What you can do to save typing latex code in Freeplane is to define a macro (usual LaTeX syntax with some limitations) in Preferences->Plugins->LaTeX->Common LaTeX Macros [1]. For your example, this works:

\newcommand{\exampleTable}{
\textbf{$Alg_0$}
\begin{tabular}{cl}
0 & \text{initialisation of $Alg_0$} \\
1 & \text{do\ some\ first\ step}\\
2 & \text{...} \\
\end{tabular}
}


(of course you can use parameters)

--> paste into the text box in Preferences->Plugins->LaTeX. --> use \exampleTable in your nodes

How does \latexinput{...} work?

from here [2]: "If your node matches the pattern \latexinput{} then Freeplane will include the given file at the given position in the LaTeX export. Note that the export will fail if the document cannot be read."

--> The idea is that our (excellent!) LaTeX library (jlatexmath) can only handle formulas, and you you can use \latexinput{} to include LaTeX that jlatexmath fails to parse in your map which will be processed by the latex (input/book/article) export only.

The reason you get this error: Error setting the text for the following input: \latexinput{alg_0.xml}. is that jlatexmath cannot parse this. Use a node (without \latex prefix) with Format=Unparsed LaTeX. This will make freeplane ignore the node, but it will be part of export.

However, with Freeplane 1.5.x, permissions are more restrictive, so you get "The following File operation is forbidden: Read /home/felix/src/alg_0.xml".

I've created a post for this [3], and I think it will be fixed yet in 1.5.x.

Please tell me if the documentation in the wiki can be improved (I can also give you wiki rights).

Cheers and Best Regards, Felix

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download