Cyprien Le Pann?rer wrote:
> 
> I have wrote a command for make latex's  preview and I need to insert
> the url in the current document.(The command is lauch by a button)
> 
> I tried  this :
> 
>  <command name="tex2img" paramater="input">
>    
>     <process>
>       <mkdir dir="/tmp/%R" quiet="true"/>
>       <copyDocument selection="true" to="/tmp/%R/tex%0.tex" />
>       <shell command="~/.xxe/addon/texmathtoimg /tmp/%R/tex%0.tex
> /tmp/%R/tex%0.png"/>
>     </process>
>     <macro>
>       <sequence>
>         <command name="insertNode" parameter="textAfter
> /tmp/%R/tex%0.png" />
>       </sequence>
>     </macro>
> 
>   </command>
> 
> Commands in process work but I don't how to add a new node after made
> the png. The macro command is an failed try.
> 
> I have this in my document
> 
> <mtex> some foo bar latex</metx>  and I want :
> 
> <mtex> some foo bar latex</metx>
> 
> <mtex_preview> file:///tmp/foo/tex4.png</mtex_preview>

[1] * A command element cannot contain both a process and a macro.

* A command element is a declaration, not an invocation. It does not
have a parameter attribute.

==> Please validate your configuration files by opening them in XXE as
you would do for any document instance (the schema of XXE configuration
files is built-in).



[2] You almost never need to insert a text node. Text nodes are almost
always automatically created because the DTD/schema specifies this.

I suspect that, in fact, you want to add a mtex_preview element
containing the URL of generated preview. This should look like this.

 <command name="tex2img">
    <macro>
      <sequence>
        <command name="tex2img_Step1"
                 parameter="'%0'" />

        <command name="insert"
                 parameter="after[implicitElement] mtex_preview" />

        <!-- The newly inserted mtex_preview element is
             automatically selected. -->

        <!-- If mtex_preview has been declared in the DTD
             to contain text, then there is already a text
             node in it and the caret is already inside this node. -->

        <command name="insertString"
                 parameter="/tmp/%R/tex%0.png"
      </sequence>
    </macro>
 </command>

 <command name="tex2img_Step1">
    <process>
      <mkdir dir="/tmp/%R" quiet="true"/>
      <copyDocument selection="true" to="/tmp/%R/tex%0.tex" />
      <shell command="~/.xxe/addon/texmathtoimg /tmp/%R/tex%0.tex
                      /tmp/%R/tex%0.png"/>
    </process>
 </command>



[3] copyDocument selection="true" copy XML nodes and not plain text.
Therefore I doubt that to="/tmp/%R/tex%0.tex" will produce a valid TeX file.


Reply via email to