Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: passing single left-quotes to latex via -texdoc-

From   Eric Booth <>
To   "" <>
Subject   st: passing single left-quotes to latex via -texdoc-
Date   Thu, 3 Feb 2011 17:07:26 +0000

*!  apologies if this comes through twice, I forgot to change the original msg to 'plain text' and I've waited a while and it hasn't come through yet
I'm using Ben Jann's -texdoc- (from SSC, -findit texdoc-) using Mac OSX 10.6 &/or Windows 7, Stata 11 MP to create a latex document.  
When sending a contraction (like "don't") to the latex document from the do-file via the -tex- command, I am having trouble because Stata interprets the single left-quote and the single right-quote as a local macro before it's sent to latex (.tex file) for processing.  
So, if I want the following the typeset latex document to show:   

          "don't know something." 

 then I would normally put this into the latex .tex document:  

         ``don't know something."   

with 2 single left-quotes in front of the word "don't"; however Stata is trying to interpret one of those with as a local macro ending in the apostrophe in the word "don't."

I tried escape characters and double quoting the left-quotes and right-quotes, but I cannot get it to pass the text to latex properly (No, I cannot change the language to "do not.")   I can get it to pass the two left-quotes properly if I change the apostrophe in "don't" to a left-quote as well, but this is not ideal (see the 3rd example below.)  

The code below shows a self-contained example of what I'm doing.  
I included an extra macro (called mymacro) to show that complicating this quotes/double quotes set up are many local macros spread throughout these sentences, which add more sets of left and right quotes to deal with.  
The part at the bottom can be discarded, but if you've got latex installed (I use miktex on windows and mactex on mac), this should process/typeset the document and allow you to see the interpreted output without having to navigate to the files -- it may not work with all configurations.

*-------------------------------------------------------*  Begin
pwd   //note: here's where the files will be stored
loc mymacro   "something here."

texdoc init dontknow, replace
tex \documentclass[12pt]{article}
tex \usepackage{times,graphicx,fancyhdr,lastpage,ulem,amsmath}
tex \begin{document}
tex ``don't know `mymacro'"  %doesnt work
tex "``"don't know `mymacro'"  %%doesnt work
tex ``don`t know `mymacro'"    %% this _works_ but w/o apostrophe
tex \end{document}
texdoc close
if "`c(os)'" == "Windows"{
	cap rm "dontknow.pdf"
	!pdflatex "dontknow.tex"
	di as smcl `"CLICK TO OPEN: {browse `"dontknow.pdf"'}"'

if "`c(os)'" == "MacOSX" {
	**no, pdflatex is not in my $PATH for some local configuration reasons**
	!/usr/texbin/pdflatex  "dontknow.tex"  "dontknow"
	!open "dontknow.pdf"
	di as smcl `"CLICK TO OPEN: {browse `"dontknow.pdf"'}"'
*-------------------------------------------------------*  End

I've searched several latex help pages, but this really is a issue that happens on the Stata-side of things (before it's sent to the .tex file) so I'm hoping others here might have come across this issue and found a better solution than using a single left-quote in place of the apostrophe.
Thanks for any suggestions.

- Eric

Eric A. Booth
Public Policy Research Institute
Texas A&M University
Office: +979.845.6754
Fax: +979.845.0249

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index