f

#### 'quote' to quote'

Hi,
what is the way to change 'shocking,' said Sally
into shocking', said Sally
author.txt file?

Does this method also change "whatever happens," he said
into whatever happens.'' he said.

David R

 0
1/10/2007 11:20:33 AM
comp.text.tex 39027 articles. 3 followers.

22 Replies
1190 Views

Similar Articles

[PageSpeed] 14

David R <angel_ov_north@tiscali.co.uk> wrote:

> what is the way to change 'shocking,' said Sally
> into shocking', said Sally
>   automatically as Tex read the
> author.txt file?

It is possible (e.g. via an active '). But I suspect, this
is a lot easier using a script language or similar.
Also you should consider ['s] coming from genitive
and other uses of the apostrophe.

Yours sincerely
Heiko <oberdiek@uni-freiburg.de>

 0
oberdiek (2375)
1/10/2007 11:38:08 AM
David R wrote:

> what is the way to change 'shocking,' said Sally
> into shocking', said Sally
>   automatically as Tex read the
> author.txt file?

Tricky thing to do on the TeX level because you can't tell a quote
from an apostrophe in a reliable and efficient way.

This will probably require pre-processing of author.txt (it's no big
deal with regular expressions).

> Does this method also change "whatever happens," he said
> into whatever happens.'' he said.

Assuming you're using Latex: try the csquotes package. See
\MakeOuterQuote{"} in the tutorial.

--
You can still reach me by email at: plehman gmx net.

 0
1/10/2007 11:44:14 AM
On Wed, 10 Jan 2007 12:44:14 +0100, Philipp Lehman <devnull.1.lehman@spamgourmet.com> wrote:
> David R wrote:
>
> > what is the way to change 'shocking,' said Sally
> > into shocking', said Sally
> >   automatically as Tex read the
> > author.txt file?
>
> Tricky thing to do on the TeX level because you can't tell a quote
> from an apostrophe in a reliable and efficient way.

This might prove an interesting test case (taken from Mystery Mile by
Margery Allingham, 1933):

 'E ain't a foreigner,' said Georse.  'E talks same as I do.'

Or this from a little lower down the same page.

T'other gentleman wot come s'afternoon was a proper foreigner,' said
'Andry, ...  'E couldn't 'ardly understand what I said to un. 'E got
riled with I. I couldn't 'elp laughin'.'

> This will probably require pre-processing of author.txt (it's no big
> deal with regular expressions).

Not sure I'd want to write the regexp to deal with those Allingham
examples.

Regards, Trevor

<>< Re: deemed!

 0
1/10/2007 12:26:38 PM
I thought that certain other Tex implentations (which I have forgotten
the name of) enable the user to do what I have described with a simple
switch somewhere.  But the implementation I am thinking of was aimed at
scientists not the commercial publishing industry.  I thought that
publishers use latex widely when publishing popular fiction.  Therefore
I thought that this feature would be more useful in latex than other
scientific implementations.  I am surprised to learn that no package has
been written to do this yet.

Is a script something which is written in tex and latex, and which could
use the ifthen package?

How does a pre-processor work?  Is it an executable binary which the tex
processor calls after the \begin{document}

What is the command to call something like this externally?  Where would
the binary reside in the TDS structure?

I dislike c with a passion and know no perl or anything else really.  Is
a binary written on a winxp machine incompatible for Unix based machines?

How does one go about writing a pre-processor as perl or java which will
be compiled automatically by run-time libraries on Unix, and on win XP?

Is there any place on the web which will answer all these questions in
an obvious simple way without bombarding me with millions of command
names and environments?

David R

 0
1/10/2007 12:38:52 PM
David R <angel_ov_north@tiscali.co.uk>  schrieb:

> I thought that certain other Tex implentations (which I have forgotten
> the name of) enable the user to do what I have described with a simple
> switch somewhere.

I don't think that such an implementation exists. There exist some
editors that changes quotes while you type your text with the help of
some heuristics that works in most (but not all) cases. To decide if a
' should be changed in a  isn't easy. Look at the examples of Trevor:
are you able to describe to a human all the rules and the exceptions he
need to know to make the correct decisions?

> But the implementation I am thinking of was aimed at
> scientists not the commercial publishing industry.  I thought that
> publishers use latex widely when publishing popular fiction.  Therefore
> I thought that this feature would be more useful in latex than other
> scientific implementations.  I am surprised to learn that no package has
> been written to do this yet.

I use the csquotes package and add the correct quotes (in my case �..�)
when writing the text. When I get text with wrong quotes, I use search
and replace to correct them and it seldom works without some manual
work.

> How does a pre-processor work?  Is it an executable binary which the tex
> processor calls after the \begin{document}

No it is binary that is called before ("pre") tex to correct or change
the source file.

--
Ulrike Fischer
e-mail: zus�tzlich meinen Vornamen vor dem @ einf�gen.
e-mail: add my first name between the news and the @.

 0
news9686 (1970)
1/10/2007 1:20:46 PM
> This might prove an interesting test case (taken from Mystery Mile by
> Margery Allingham, 1933):
>
>   'E ain't a foreigner,' said Georse.  'E talks same as I do.'
>
> Or this from a little lower down the same page.
>
>  T'other gentleman wot come s'afternoon was a proper foreigner,' said
>  'Andry, ...  'E couldn't 'ardly understand what I said to un. 'E got
>   riled with I. I couldn't 'elp laughin'.'
>
>> This will probably require pre-processing of author.txt (it's no big
>> deal with regular expressions).
>
> Not sure I'd want to write the regexp to deal with those Allingham
> examples.
>
> Regards, Trevor
>
> <>< Re: deemed!

Here's how I reckon it could be done

<any character>\<any spacing>'<space> at the end or middle of the word
can be ignored because it is already what is desired by TeX.  So are
apostrophes at the end of the word and at the middle of the word.

should've and the horses' stable are already what we want.

Now there are only 3 things which need to be changed.
<space>'\<any spacing><any character> into <space>\<THE spacing><THE
character>

and

" into either  or ''
<space>"\<any spacing><any character> into <space>\<THE spacing><THE
character>

and

<any character>\<any spacing>"<space> into <THE character>\THE
spacing>''<space>

In the example above   'E ain't a foreigner,' said Georse.
has now become   E ain't a foreigner,' said Georse.

So define a function as \<package>@' for an abbreviation at the
beginning of a word.

Any writer or proof reader can remember one command to be used in one
instance and only at the beginning of a word and not the middle or the
end of it.  This is what lay-people want : a nice and easy life with
only one thing to remember and look out for, not a dozen of things.
Trying to automate this task might inevitably lead to a dozen further
problems.

I think that this solution would be simple, but I might have overlooked
something.

How I go about getting the computer to do this I am pretty ignorant
about and would like further help with.

David R

 0
1/10/2007 1:23:26 PM
As I've said before, This sort of thing simply can't be automated
'cause it's dependent 'pon language usage. 'Struth.'' 'n' anyone who
doesn't agree will be pounded with a $5' 2"$ pole.

16 times a year I search through all the text of a Journal which I
produce here at my day job checking for:

- hyphens and determining if they should be left alone (but adding a
discretionary hyphen at the beginning of the compound so that it
doesn't break elsewhere), or be converted to non-breaking hyphens, or
converted to an en or em-dash or a mathematical minus.

- apostrophes to see if they should be single or double quote marks or
single or double primes or apostrophes

-  x '' to see if it should become a multiplication sign

_And_ I have to set all of the ff'', ffi'' and ffl'' ligatures
using an AppleScript (I loathe Quark --- 'n' I doubt that our eventual
upgrade to Quark 7 will change my loathing, though it will (finally!)
allow us to use OpenType fonts w/ ligatures appropriately).
Fortunately, a WordBASIC macro has already pre-processed to set all of
the Greek and other special characters.

If typography were easy, Word wouldn't be the foetid mess which it is.

William


 0
1/10/2007 1:39:22 PM
David R <angel_ov_north@tiscali.co.uk>  schrieb:

> Here's how I reckon it could be done
>
> <any character>\<any spacing>'<space> at the end or middle of the word
> can be ignored because it is already what is desired by TeX.  So are
> apostrophes at the end of the word and at the middle of the word.

The left quote should be typed as "'" and the right quote should be
typed as "'".

In other languages (e.g. french) they are often spaces between the
opening quote and the first word and between the end of a word and the
closing quote. Or apostrophs at the begin of a word can look different
than an opening quote.

You should really read the documentation of csquotes to get an
impression about the variaty of conventions involved with the handling
of quotes.

--
Ulrike Fischer
e-mail: zus�tzlich meinen Vornamen vor dem @ einf�gen.
e-mail: add my first name between the news and the @.

 0
news9686 (1970)
1/10/2007 1:45:16 PM
On Wed, 10 Jan 2007 13:23:26 +0000, David R <angel_ov_north@tiscali.co.uk> wrote:
>
> > This might prove an interesting test case (taken from Mystery Mile by
> > Margery Allingham, 1933):
> >
> >   'E ain't a foreigner,' said Georse.  'E talks same as I do.'
>
> Here's how I reckon it could be done
>
> <any character>\<any spacing>'<space> at the end or middle of the word
> can be ignored because it is already what is desired by TeX.  So are
> apostrophes at the end of the word and at the middle of the word.
>
> should've and the horses' stable are already what we want.
>
> Now there are only 3 things which need to be changed.
> <space>'\<any spacing><any character> into <space>\<THE spacing><THE
> character>

Incorrect. An informal parse of the opening of that first Allingham
example would be

<quote>&apostrophe;E ...

It's actually dialect for He

> In the example above   'E ain't a foreigner,' said Georse.
> has now become   E ain't a foreigner,' said Georse.

'Twould be wrong.

God Bless You.

Regards, Trevor

<>< Re: deemed!

 0
1/10/2007 2:01:00 PM
David R wrote:

> So define a function as \<package>@' for an abbreviation at the
> beginning of a word.
[...]
> I think that this solution would be simple, but I might have
> overlooked something.

Using a TeX-based solution, you can only look ahead at the following
token(s), but you normally can't look back.

> How I go about getting the computer to do this I am pretty ignorant
> about and would like further help with.

You'd basically make the ' active and define it such that it looks
ahead at the following token(s) and makes a decision. That's all the
information you have on this level. And that's not sufficient to

--
You can still reach me by email at: plehman gmx net.

 0
1/10/2007 2:15:33 PM
Philipp Lehman <devnull.1.lehman@spamgourmet.com> writes:

> David R wrote:
>
>> So define a function as \<package>@' for an abbreviation at the
>> beginning of a word.
> [...]
>> I think that this solution would be simple, but I might have
>> overlooked something.
>
> Using a TeX-based solution, you can only look ahead at the following
> token(s), but you normally can't look back.

\ifhmode \ifnum\lastskip>\z@

should detect preceding spaces somewhat reliably.

--
David Kastrup

 0
dak (3569)
1/10/2007 2:42:28 PM
 Ulrike Fischer <news@nililand.de> writes:
>David R <angel_ov_north@tiscali.co.uk>  schrieb:
>
>> I thought that certain other Tex implentations (which I have forgotten
>> the name of) enable the user to do what I have described with a simple
>> switch somewhere.
>
>I don't think that such an implementation exists. There exist some
>editors that changes quotes while you type your text with the help of
>some heuristics that works in most (but not all) cases.

i would imagine he's thinking of emacs, which is emphatically not part
of a tex implementation, but has .el files that deal with quotes
modestly well.

>To decide if a
>' should be changed in a  isn't easy. Look at the examples of Trevor:
>are you able to describe to a human all the rules and the exceptions he
>need to know to make the correct decisions?

'ee'll find 'er easy 'nuff if dee'll learn'a speak proper.
(you'll find it easy enough if you'll learn to speak properly)

personally, i wouldn't expect *anything* (other than the human brain)
to reliably represent transcribed dialect english.  the above comes
from the area where i went to school; my ex-wife used to say things
like

put wood in't'oil
(put [the] wood into the hole)

meaning "shut the door".
--
Robin Fairbairns, Cambridge

 0
rf10 (3613)
1/10/2007 4:18:45 PM
David Kastrup wrote:
> Philipp Lehman <devnull.1.lehman@spamgourmet.com> writes:
>
> > David R wrote:
> >
> >> So define a function as \<package>@' for an abbreviation at the
> >> beginning of a word.
> > [...]
> >> I think that this solution would be simple, but I might have
> >> overlooked something.
> >
> > Using a TeX-based solution, you can only look ahead at the following
> > token(s), but you normally can't look back.
>
> \ifhmode \ifnum\lastskip>\z@
>
> should detect preceding spaces somewhat reliably

One also needs to handle ' at the start of a paragraph.
Very hard to do with all the possible ways that exist
to initiate a paragraph.

Also non-skip spaces (\kern, empty boxes, etc.) need
detecting. And paranthetical quotes ('What!'). Nested

Dan


 0
luecking (1319)
1/10/2007 4:52:22 PM
> The left quote should be typed as "'" and the right quote should be
> typed as "'".

This would not work, but it doesn't matter.  A person who is typesetting
an English writer's document won't encounter such combinations often,
and nobody who knows TeX would try to put this into TeX intentionally.
It would be picked up by the proof-reader, and the work involved in
correcting it would be minimal and simple because it will occur very
rarely : one manual alteration instead of 300 changes.

> In other languages (e.g. french) they are often spaces between the
> opening quote and the first word and between the end of a word and the
> closing quote.

Well I think I included this with \<any spaces> bit.

Or apostrophes at the begin of a word can look different
> than an opening quote.

Set it manually with \XXX@'.  Do apostrophes in the middle of the word
look the same as the beginning and both different than quote?

David R

 0
1/10/2007 7:32:28 PM
 > An informal parse of the opening of that first Allingham
> example would be
>
> <quote>&apostrophe;E ...
>
How can I do an informal parse?
It there some command to give LaTeX
or some file to view.

David R

 0
1/10/2007 7:35:39 PM
> put wood in't'oil
> (put [the] wood into the hole)
>
> meaning "shut the door".

I've been reliably informed that somebody grandpa used to say
Put sneck in't 'ole''

The sneck is the latch which goes into the catch.

 0
1/10/2007 7:41:36 PM
On Wed, 10 Jan 2007 19:35:39 +0000, David R <angel_ov_north@tiscali.co.uk> wrote:
>  > An informal parse of the opening of that first Allingham
> > example would be
> >
> > <quote>&apostrophe;E ...
> >
> How can I do an informal parse?

Read it. That is by "informal parse" I meant *I* looked at it and used my
knowledge of English, English dialect, and English punctuation to decide
what was actually printed on the page.

Regards, Trevor

<>< Re: deemed!

 0
1/10/2007 8:11:56 PM
Trevor Jenkins wrote:
> On Wed, 10 Jan 2007 19:35:39 +0000, David R <angel_ov_north@tiscali.co.uk> wrote:
>>  > An informal parse of the opening of that first Allingham
>>> example would be
>>>
>>> <quote>&apostrophe;E ...
>>>
>> How can I do an informal parse?
>
> Read it. That is by "informal parse" I meant *I* looked at it and used my
> knowledge of English, English dialect, and English punctuation to decide
> what was actually printed on the page.
>
> Regards, Trevor
>

Then what is the significance of the & and the ;
what do these symbols infer?

 0
1/10/2007 10:32:54 PM
The following is taken from the calc documentation.  Is it relevant to
this problem?

> We evaluate expressions by explicit scanning of characters. We do not rely on
> active characters for this.
> The scanner consists of two parts, \calc@pre@scan and \calc@post@scan;
> \calc@pre@scan consumes left parentheses, and \calc@post@scan consumes bi-
> nary operator, \real, \ratio, and right parenthesis tokens.
> \calc@pre@scan
> \@calc@pre@scan
> Note that this is called at least once on every use of calc processing, even when
> none of the extended syntax is present; it therefore needs to be made very efficient.

....

> The many \expandafters are needed to efficiently end the nested conditionals
> so that \calc@textsize and \calc@maxmin@addsub can process their argument.
> 35 \def\calc@pre@scan#1{%
> 36 \expandafter\@calc@pre@scan\romannumeral-�\a#1}
> 37 \def\@calc@pre@scan#1{%
> 38 \ifx(#1%
> 39 \expandafter\calc@open
> 40 \else
> 41 \ifx\widthof#1%
> 42 \expandafter\expandafter\expandafter\calc@textsize
> 43 \else
> 44 \ifx\maxof#1%
> 45 \expandafter\expandafter\expandafter\expandafter
> 47 \else
> 48 \calc@numeric% no \expandafter needed for this one.
> 49 \fi
> 50 \fi
> 51 \fi
> 52 #1}

> \calc@open is used when there is a left parenthesis right ahead. This parenthesis
> is replaced by TEX code corresponding to the code sequence

David R

 0
1/11/2007 1:58:50 AM
 David R <angel_ov_north@tiscali.co.uk> writes:
>Trevor Jenkins wrote:
>> On Wed, 10 Jan 2007 19:35:39 +0000, David R
>>   <angel_ov_north@tiscali.co.uk> wrote:
>>>  > An informal parse of the opening of that first Allingham
>>>> example would be
>>>>
>>>> <quote>&apostrophe;E ...
>>>
>>> How can I do an informal parse?
>>
>> Read it. That is by "informal parse" I meant *I* looked at it and used my
>> knowledge of English, English dialect, and English punctuation to decide
>> what was actually printed on the page.
>
>Then what is the significance of the & and the ;
>what do these symbols infer?

the symbols aren't intelligent, they infer nothing.

&apostrophe; is obviously intended to look like an html character
entity.  so "&" and ";" imply that trevor couldn't think of any more
compact way of writing apostrophe in that context.
--
Robin Fairbairns, Cambridge

 0
rf10 (3613)
1/11/2007 12:51:02 PM
On 11 Jan 2007 12:51:02 GMT, Robin Fairbairns <rf10@cl.cam.ac.uk> wrote:
>  David R <angel_ov_north@tiscali.co.uk> writes:
> >Trevor Jenkins wrote:
> >> On Wed, 10 Jan 2007 19:35:39 +0000, David R
> >>   <angel_ov_north@tiscali.co.uk> wrote:
> >>>  > An informal parse of the opening of that first Allingham
> >>>> example would be
> >>>>
> >>>> <quote>&apostrophe;E ...
> >>>
> >>> How can I do an informal parse?
> >>
> >> Read it. That is by "informal parse" I meant *I* looked at it and used my
> >> knowledge of English, English dialect, and English punctuation to decide
> >> what was actually printed on the page.
> >
> >Then what is the significance of the & and the ;
> >what do these symbols infer?
>
> the symbols aren't intelligent, they infer nothing.
>
> &apostrophe; is obviously intended to look like an html character
> entity.

Close but no ... okay you get the butt end of a cigar. ;-) Not so much
HTML as SGML with an alternate concrete syntax that permits the use of
longer entity names than the standard concrete syntax allows.

> ...  so "&" and ";" imply that trevor couldn't think of any more
> compact way of writing apostrophe in that context.

For that you can have the entire cigar. ;-)

Regards, Trevor

<>< Re: deemed!

 0
1/11/2007 10:13:22 PM
On Wed, 10 Jan 2007 11:20:33 +0000, David R
<angel_ov_north@tiscali.co.uk> wrote:

>what is the way to change 'shocking,' said Sally
>into shocking', said Sally
>  automatically as Tex read the
>author.txt file?
>
>Does this method also change "whatever happens," he said
>into whatever happens.'' he said.

My editor does that for me as I type. For an existing file, you can
try some naive substitution, e.g.

#!/usr/bin/perl -p0777

s/(?(?<=\s)|^)'(\w*?)([[:punct:]]?)'(?(?=\s)|$)/$1'$2/gs; s/(?(?<=\s)|^)"([\w\s\n]*?)([[:punct:]])"(?(?=\s)|$)/$1$2''/gs;

__END__

But it will grossly fail if you have unbalanced single and double
quotes, which may well be the case if there are any apostrophes,
although some care is taken to avoid some such cases. And, hey, I'm
not Friedl after all!

Michele
--
>It's because the universe was programmed in C++.
No, no, it was programmed in Forth.  See Genesis 1:12:
"And the earth brought Forth ..."
- Robert Israel in sci.math, thread "Why numbers?"

 0
bik.mido (626)
1/15/2007 5:11:45 PM