Bookmark and Share

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


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

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


From   Johannes Geyer <[email protected]>
To   [email protected]
Subject   Antwort: st: passing single left-quotes to latex via -texdoc-
Date   Thu, 3 Feb 2011 20:48:07 +0100

Richard answer is great; here are just two more options to your problem.

a) you can escape the local by escaping the first left-single-quote [this, I do not understand but it works fine]

b) you can refer directly to the ascii apostrophe (char(39)

*********************************************
loc mymacro   "something here."
/* your working directory */
cd c:\temp\

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
tex "``"don't know `mymacro'"  %%doesnt work
tex
tex ``don`t know `mymacro'"    %% this _works_ but w/o apostrophe
tex `\`don't know `mymacro'"    %% this works
tex ``don`=char(39)'t know `mymacro'"    %% and this works
tex \end{document}
texdoc close
*************** fin *********************


best
johannes


----------------------
Johannes Geyer
Deutsches Institut für Wirtschaftsforschung (DIW Berlin)
German Institute for Economic Research
Department of Public Economics
DIW Berlin
Mohrenstraße 58
10117 Berlin
Tel: +49-30-89789-258

[email protected] schrieb: -----

An: "[email protected]" <[email protected]>
Von: Eric Booth <[email protected]>
Gesendet von: [email protected]
Datum: 03.02.2011 06:07PM
Thema: st: passing single left-quotes to latex via -texdoc-

<>
*!  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:

then I would normally put this into the latex .tex document:
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
clear
pwd   //note: here's where the files will be stored
loc mymacro   "something here."

*****texdoc
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
tex "``"don't know `mymacro'"  %%doesnt work
tex
tex ``don`t know `mymacro'"    %% this _works_ but w/o apostrophe
tex \end{document}
texdoc close
*-------------------------------------------------------*
if "`c(os)'" == "Windows"{ 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
[email protected]
Office: +979.845.6754
Fax: +979.845.0249




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