Announcement

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

  • texdoc trouble

    Hi All. I'm trying to reproduce Ben Jan's example of his command texdoc and get the same warning from Stata
    HTML Code:
     texdoc init myexample.tex, replace
    
            /*tex
            \documentclass{article}
            \usepackage{graphicx}
            \usepackage{stata}
            \begin{document}
    
            \section{Exercise 1}
            Open the 1978 Automobile Data and summarize the variables.
    
            tex*/
    
            texdoc stlog
            sysuse auto
            summarize
            texdoc stlog close
    
            /*tex
    
            \section{Exercise 2}
            Run a regression of price on milage and weight.
    
            tex*/
    
            texdoc stlog
            regress price mpg weight
            texdoc stlog close
            
            /*tex
            
            \end{document}
            tex*/
    When Stata runs the code the answer is always the same:

    HTML Code:
    .  texdoc init myexample.tex, replace
    (texdoc do not running; nothing to do)
    
    . 
    .         /*tex
    >         \documentclass{article}
    >         \usepackage{graphicx}
    >         \usepackage{stata}
    >         \begin{document}
    > 
    >         \section{Exercise 1}
    >         Open the 1978 Automobile Data and summarize the variables.
    > 
    >         tex*/
    . 
    .         texdoc stlog
    (texdoc not initialized; nothing to do)
    
    .         sysuse auto
    (1978 Automobile Data)
    
    .         summarize
    
        Variable |        Obs        Mean    Std. Dev.       Min        Max
    -------------+---------------------------------------------------------
            make |          0
           price |         74    6165.257    2949.496       3291      15906
             mpg |         74     21.2973    5.785503         12         41
           rep78 |         69    3.405797    .9899323          1          5
        headroom |         74    2.993243    .8459948        1.5          5
    -------------+---------------------------------------------------------
           trunk |         74    13.75676    4.277404          5         23
          weight |         74    3019.459    777.1936       1760       4840
          length |         74    187.9324    22.26634        142        233
            turn |         74    39.64865    4.399354         31         51
    displacement |         74    197.2973    91.83722         79        425
    -------------+---------------------------------------------------------
      gear_ratio |         74    3.014865    .4562871       2.19       3.89
         foreign |         74    .2972973    .4601885          0          1
    
    .         texdoc stlog close
    (texdoc not initialized; nothing to do)
    
    . 
    .         /*tex
    > 
    >         \section{Exercise 2}
    >         Run a regression of price on milage and weight.
    > 
    >         tex*/
    . 
    .         texdoc stlog
    (texdoc not initialized; nothing to do)
    
    .         regress price mpg weight
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(2, 71)        =     14.74
           Model |   186321280         2  93160639.9   Prob > F        =    0.0000
        Residual |   448744116        71  6320339.67   R-squared       =    0.2934
    -------------+----------------------------------   Adj R-squared   =    0.2735
           Total |   635065396        73  8699525.97   Root MSE        =      2514
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             mpg |  -49.51222   86.15604    -0.57   0.567    -221.3025     122.278
          weight |   1.746559   .6413538     2.72   0.008      .467736    3.025382
           _cons |   1946.069    3597.05     0.54   0.590    -5226.245    9118.382
    ------------------------------------------------------------------------------
    
    .         texdoc stlog close
    (texdoc not initialized; nothing to do)
    
    .         
    .         /*tex
    >         
    >         \end{document}
    >         tex*/
    . 
    end of do-file
    Can you help me?
    Thank you very much

  • #2
    Try adding:

    Code:
    texdoc close
    At the end of your do file.

    Also, force option after texdoc init might be needed?

    Comment


    • #3
      You have to store the code in a file, say myexample.do, and then type:
      Code:
      . texdoc do myexample.do
      texdoc has to do a lot of pre-processing, this is why it has to be used that way.

      texdoc close is not needed because texdoc do automatically closes the file.

      You can specify the force option with texdoc init and run the code interactively (i.e. without applying texdoc do), but used this way many of the features do not work (e.g. /*tex tex*/ blocks will be ignored). Also you need a texdoc close at the end if you use it that way.

      Ben

      Comment


      • #4
        Hi there
        thank you for your post Ben. I'm working on a time series project with a friend. We followed rigorously your tips from that post. We created a special file (see attachment) and used texdoc do to execute. It works everywhere but in the following lines:
        Code:
         tex*/
        texdoc stlog arima lngdp_fr, arima(2,1,0)
        texdoc stlog close
         /*tex
        we get the follwoing error message
        Code:
        . texdoc stlog close
        (texdoc not initialized; nothing to do)
        The .tex document is produced fine till that point but not further... We didn't find any solution or reason for that. Neither in the documentation nor by googling the problem... Any help is very appreciated! Matthias
        Attached Files
        Last edited by Matthias Endres; 17 May 2017, 14:01.

        Comment


        • #5
          Sorry, I've put the do file with our tedious work arround. So the crucial part is in the code boxes but not in the file.

          Comment


          • #6
            In #4 there is invalid texdoc syntax because
            Code:
            arima lngdp_fr, arima(2,1,0)
            needs to be on the next line after texdoc, not on the same line.
            I do not understand #5.

            Comment


            • #7
              Thank you Andres Andersson,
              Sorry I made a mistake when posting the code. In the do file
              Code:
              arima lngdp_fr, arima(2,1,0)
              is in the next line after texdoc. Thus the error posted comes from something else


              (#5 just says that I put accidentaly the wrong do file. Sorry for that.)

              Comment

              Working...
              X