- download the actor system from github
- compile the actor system :
$ mvn package - make it available :
$ mvn install:install-file -Dfile=path-to-actors/target/actors.jar- download
frtexfrom github - Use
frtexby example performing the tests :
$ mvn testThe "latex actor system" is intended to take as input a LaTeX filename and produce as output the "recursive" content of that file with all the \input{file} explicitly replaced by the content of "file.tex".
The use of our actor system makes the recomposition work extremely multi-thread and then(?) efficient.
This is still under development.
The behaviour of an actor is :
- read its LaTeX file
- create a list of the inputed files.
- for each of them, ask an other actor to make the job.
- when all the answers are received, recompose the LaTeX file
- send the result to the actor whose asked.
The only class you have to work with is LatexCode. That class provides an abstraction that hides the actor system to the user.
A LatexActor can be active or not, as any actor. The LatexActor has an other status that is "working" or not.
An actor which is requested to create the code of the file "foo.tex" reads this file and send a request message to a new actor each time that it encounters a "\input" in "foo.tex". Such an actor has to be able to read new messages since it relies on the answer messages in order to complete its work.
So such a working actor is set "inactive" in order to unlock its mail box. But it is still working and cannot be requested to work on an other tex file until "foo.tex" is completed and sent to the calling actor.
The LatexActorSystem has a method
public LatexActorRef getNonWorkingActor()which return an actor reference to an actor who can be requested to deal with a new tex file. The actor is 'working' from the moment it is returned.
The latex actor system recognize two types of messages.
LatexMessage(abstract)LatexRequestMessage(extendsLatexMessage)LatexAnswerMessage(extendsLatexMessage)
-
The filenames are more or less standard. Like only one dot, no curly braces and so on.
-
The percent symbol should always mean a comment, with the exception of "%". This can be a limitation if you have URL in which you substituted special characters with their %xx representation.
-
If a file in inputed more than once, it will be computed at each input. Moreover, this is a static tool, so you cannot do
\input{foo}
% something that modify foo.tex during the LaTeX compilation.
\input{foo}-
More generally, if your LaTeX compilation itself create/modify a file that is then inputed, you cannot hope
frtexto make its job. -
The LaTeX code is supposed to be encoded in utf8
-
The
\inputhas to be explicit.frtexwill not make the substitution on
\newcommand{\myInput}[1]{\input{#1}}
\myInput{foo}-
In the same spirit,
\lstinputfrom packagelistingutf8will not be recognized. It is however in my plans to make it in the future (send me a patch). -
When inputing a tex file, use
\input{foo}and not
\input{foo.tex}- Filename must contain (at most) one dot. You cannot do
\input{fdl-1.3}for implying an input of fdl-1.3.tex. And even less
\input{fdl-1.3.tex}The produced LaTeX code is in general not a standalone that can be fed to pdflatex.
-
Commands like
\inlcudegraphicor\lstinputlistingare including external files that are not processed here. -
For the bibliography, it is in project to make the replacement of
\bibliography{foo}by the content offoo.bbl. -
In particular for mazhe, the exercices are included by the macro
\Exothat makes a conditional\input.
These points explain why the test directory mazhe_tex_test is so large : this is a real live test, and the real live does not fulfills the limitations of some softwares (one should fix the live).
The input mechanism in LaTeX seems complex and I didn't study it. In particular, what makes the space after an input ? This question has an answer that is too complicated for me.
If someone can explain me that clearly, I'd appreciate.
\documentclass{minimal}
\begin{document}
AB
\input{1_file}\input{2_file}
\input{1_file}
\input{2_file}
\end{document} with 1_file.tex containing only "A" and 2_file.tex containing "B" (no 'new line' or something). frtex will add a \n after the input if it is not followed by an other \n. So it will translate the second and third examples in the same way. LaTeX makes a difference that I do not understand.
\begin{equation}
\input{foo}
\end{equation}with foo.tex containing "a=b" does not provoke error. This is why frtex does not add a "\n" if the input statement is already followed by a newline.
Fixing this bug would require pure LaTeX (not Java) knowledge that I don't have. In particular, clearly understand the answer here.
I sometimes have a NullPointerException in MultiFIFOMap.poll. Not always. Search in progress ...
use mvn test to see the result.
Notice that this software is still under development. I try to not commit (and even less push) versions that do nothing else than a crash...