[R] odfWeave : problems with odfInsertPlot() and odfFigureCaption()

Emmanuel Charpentier charpent at bacbuc.dyndns.org
Wed Jul 1 00:08:12 CEST 2009


Dear Max, dear list,

I have trouble using odfInsertPlot to insert plots outside fig=TRUE
chunks.

My goal is to dump a bunch of (relatively uninteresting, but required)
graphs from within a loop, possibly interspeded with some tables. This
is not possible within a normal fig=TRUE chunk.

odfInsertPlot() is able to insert a previously saved plot. When used in
a fig=TRUE, results=hide chunk, it produces just a blank frame (with a
caption if caption=odfFigureCaption() is used).

Used in a fig=TRUE, results=xml chunk, it produces an error at file
rte-assembly (see end of post). However, when wrapped in a cat(), the
same code produces 1) the figure (without caption), then a blank frame
with the caption, or just the figure (without caption) if the caption=()
argument is absent.

The same cat(odfInsertPlot()) construct can be used in a results=xml
chunk (no fig=TRUE) ; however, I found no way to insert the caption.

Therefore : I can programmatically create graphs and insert them via
results=xml chunks, but I can't caption them.

Do someone has a workaround (except reprogramming odfFigureCaption()
with a new argument taking the output of odfInsertPlot()) ?

Sincerely,

					Emmanuel Charpentier

Annex : log of compilation with fig=true, results=xml.
> odfWeave("Test1Src.odt", "Test1.odt")
  Copying  Test1Src.odt 
  Setting wd to  /tmp/RtmpenMTgz/odfWeave3023572231 
  Unzipping ODF file using unzip -o Test1Src.odt 
Archive:  Test1Src.odt
 extracting: mimetype                
  inflating: content.xml             
  inflating: layout-cache            
  inflating: styles.xml              
 extracting: meta.xml                
  inflating: Thumbnails/thumbnail.png  
  inflating: Configurations2/accelerator/current.xml  
   creating: Configurations2/progressbar/
   creating: Configurations2/floater/
   creating: Configurations2/popupmenu/
   creating: Configurations2/menubar/
   creating: Configurations2/toolbar/
   creating: Configurations2/images/Bitmaps/
   creating: Configurations2/statusbar/
  inflating: settings.xml            
  inflating: META-INF/manifest.xml   

  Removing  Test1Src.odt 
  Creating a Pictures directory

  Pre-processing the contents
  Sweaving  content.Rnw 

  Writing to file content_1.xml
  Processing code chunks ...
    1 : term hide(label=ProlégomènesStandard)
    2 : term xml(label=EssaiGraphe1)
    3 : echo term verbatim(label=TestChunk)
    4 : term xml(label=SecondChunk)

  'content_1.xml' has been Sweaved

  Removing content.xml

  Post-processing the contents
error parsing attribute name
attributes construct error
xmlParseStartTag: problem parsing attributes
Couldn't find end of Start Tag draw:frame line 6
error parsing attribute name
attributes construct error
xmlParseStartTag: problem parsing attributes
Couldn't find end of Start Tag draw:image line 6
Opening and ending tag mismatch: text:p line 6 and draw:frame
Opening and ending tag mismatch: office:text line 2 and text:p
Opening and ending tag mismatch: office:body line 2 and office:text
Opening and ending tag mismatch: office:document-content line 2 and
office:body
Extra content at the end of the document
Erreur : 1: error parsing attribute name
2: attributes construct error
3: xmlParseStartTag: problem parsing attributes
4: Couldn't find end of Start Tag draw:frame line 6
5: error parsing attribute name
6: attributes construct error
7: xmlParseStartTag: problem parsing attributes
8: Couldn't find end of Start Tag draw:image line 6
9: Opening and ending tag mismatch: text:p line 6 and draw:frame
10: Opening and ending tag mismatch: office:text line 2 and text:p
11: Opening and ending tag mismatch: office:body line 2 and office:text
12: Opening and ending tag mismatch: office:document-content line 2 and
office:body
13: Extra content at the end of the document
>




More information about the R-help mailing list