Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamic path on Markdoc

    Dear All,

    I've problem using dynamic path on markdoc. What I want to do is generate graphs in a loop, save them as an eps file and put them in a .docx generated by Markdoc.

    Here is my code :
    Code:
    capture log close
    qui log using test_markdoc, replace smcl
    
    sysuse auto.dta
    
    graph box price
    graph export box_price.eps, replace
    /***
    ![Box of price](box_price.eps)
    ***/
    
    /***
    Testing dynamic path
    ***/
    foreach var in price weight {
        graph box `var'
        graph export box_`var'.eps, replace
        txt ![Box of `var'](box_`var'.eps)
    }
    
    qui log c
    markdoc test_markdoc, replace export(docx) install
    However, the markdoc is breaking inside the loop. I've attached the log file to the post.
    I'm using Mac OS 10.9.5 with Stata/SE 14.1
    I'd rather not use the `img` command since I'm using Stata inside Emacs (in which this command is not working).

    I'd be grateful of any help.

    Best,

    Louis
    Attached Files

  • #2
    This turned out to be a bug. Interestingly, if you were exporting the graphs "quietly", there would be no bug! But anyway, the new release fixes this bug.

    Reinstall both Weaver and MarkDoc from GitHub (txt command belongs to Weaver)
    ——————————————
    E. F. Haghish, IMBI, University of Freiburg
    [email protected]
    http://www.haghish.com/

    Comment


    • #3
      To use this example, I have had success with graphics and Stata output into Word documents by turning the inclusion //ON and //OFF with
      Code:
      /**/ di "{com}. //ON"
      .

      Code:
      capture log close
      local dirA `"C:\MyPrjct\sjlatex\"'
      cd `dirA'
      qui log using test_markdoc, replace smcl
      
      sysuse auto.dta
      //OFF
      graph box price
      graph export box_price.emf, replace
      //ON
      img using `"`dirA'box_price.emf"' , ///
        title("Box of price")
      
      
      txt "Testing dynamic path"
      //OFF
      foreach var in price weight {
          graph box `var'
          graph export box_`var'.emf, replace
      /**/ di "{com}. //ON"
          img using `"`dirA'box_`var'.emf"' , ///
        title("Box of `var'")
      /**/ summarize `var' , detail
      /**/ di "{com}. //OFF"
      }
      Attached Files

      Comment

      Working...
      X