Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: question on local macros ina graph title


From   Eric Booth <ebooth@ppri.tamu.edu>
To   "<statalist@hsphsun2.harvard.edu>" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: question on local macros ina graph title
Date   Mon, 11 Apr 2011 13:36:19 +0000

<>
On Apr 11, 2011, at 8:25 AM, Eric Booth wrote:
> Wrapping in graph titles (or axis labels, notes, captions, etc) occurs when there are embedded 
> quotes in the title, so "Database Analysis" will not wrap, `" " Database" "Analyses" "' will wrap.
> 

Sorry, that should have said that " " Database" "Analyses" " wraps in the title option (if you include the single quotes 
it will not wrap).  I had it right in the example.


On Apr 11, 2011, at 8:22 AM, Data Analytics Corp. wrote:
> Maartin's example worked.  I needed to use
> 
> title("`title'")
> 
On Apr 11, 2011, at 8:31 AM, Nick Cox wrote:

> I am glad that you got it to work, but it's not clear why that makes a
> difference!


If adding double quotes to the title option caused the OP's title to unwrap, then
the macro probably already contained compound quotes (such as when a list
is tokenized), e.g., 

local title `" `"Database"' `"Analyses"'"'

Adding double quotes to the title option here will cause it to unwrap.

Again, modifying Maarten's example:
*-------------- begin example ---------------
sysuse auto, clear
local title `" `"Database"' `"Analyses"'"'

**NO DOUBLE QUOTES IN TITLE() OPT
forvalues i = 1/1 {
  scatter price mpg if rep78==`i', ///
          title(`title' )         ///
          name(gr`i', replace)
}

**DOUBLE QUOTES ADDED TO TITLE() OPT
forvalues i = 1/1 {
  scatter price mpg if rep78==`i', ///
          title("`title'")         ///
          name(gr`i', replace)
}
*--------------- end example ----------------


- Eric

__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
ebooth@ppri.tamu.edu
Office: +979.845.6754

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index