Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: A couple of file command questions for writing a .tex program


From   Thomas Jacobs <[email protected]>
To   [email protected]
Subject   Re: st: RE: A couple of file command questions for writing a .tex program
Date   Thu, 16 Apr 2009 14:38:12 -0500

Nick,

As always thanks for the detailed reply.  $10 is cheap compared to the
time I have spent already.  Where do I mail the check?

Tom

On Thu, Apr 16, 2009 at 2:26 PM, Nick Cox <[email protected]> wrote:
> The meta-reply is to rummage in [U] as these matters are explained
> carefully and fully there. The kind of programming you are doing is
> fiddly and you need a decent source by your hand and preferably
> transferred to your brain.
>
> In essence, you need compound double quotes `" "' (hereafter c.d.q.)
> whenever you are nesting double quotes " " as the latter are ambiguous.
> But c.d.q. do no harm if they are not needed.
>
> An example of the problem is "a"b"c". Is this
>
> "a"
>
> followed by
>
> b
>
> followed by
>
> "c"
>
> Or is it
>
> "b"
>
> nested within a string that starts "a and ends c". You may know what you
> mean but Stata hasn't a chance because a beginning " and an ending " are
> of course exactly the same symbol. However c.d.q. are clearly different
> as `" and "' are distinguishable by programmer and machine alike. Each
> c.d.q. is logically a single symbol although typed as two (same story as
>>=, <=, !=, etc.).
>
> In essence too: if you mean $ to indicate anything other than a global
> macro symbol you must escape it with \. That's not an absolute as Stata
> manages to be a bit smart about e.g. $10 which is what this email would
> cost you at a decent consultancy rate.
>
> Nick
> [email protected]
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Thomas Jacobs
> Sent: 16 April 2009 20:14
> To: StataList
> Subject: st: A couple of file command questions for writing a .tex
> program
>
> Fellow listers,
>
> I am trying to learn to write Latex files from Stata/Mata with the
> file commands and have a couple of questions:
>
> 1.  What is the difference between using simple quotes " xxx "
> compared with `" xxx "' type quotes?  The user manual displays simple
> quotes for write commands
>
> file write handle "first part is"
>
> while in the Gini/Pasquini' Automatic Generation of Document article
> from Stata Journal vol 6 number 1, the typical example
> uses a format like,
>
> file write handle  `"first part is"'
>
> I would like to know how they are treated differently, if at all.
>
> 2.  A more complicated question.  How does one use a $ sign in a file
> write command and not have Stata treat it as a global macro?  For
> instance, the end of the following command:
>
> file write tex "\begin{tabular}{lrrrrrrrrrrr}\hline\\ \scriptsize
> Model & `: word 1 of `:colname e(b)'' & p-val & "
> file write tex "`: word 2 of `:colname e(b)'' & p-val & `: word 3 of
> `:colname e(b)'' & p-val & `: word 4 of `:colname e(b)'' & "
> file write tex "p-val & `: word 5 of `:colname e(b)'' & p-val & adj.
> $R^2$ \\" _n
> file write tex "\vspace{0.05in}" _n
>
> generates:
>
> \begin{tabular}{lrrrrrrrrrrr}\hline\\ \scriptsize Model & FFMkt &
> p-val & SMB & p-val & HML & p-val & UMD & p-val & _cons & p-val & adj.
> ^2$ \\
>
> and I end up with ^2$ as opposed to the $R^2$ term I need for a Latex
> math string.  I also tried
>
> `=char(35)'R^2$
>
> without any change in results.  Any suggestions would be much
> appreciated.
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>



-- 
Thomas Jacobs

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index