Re: [Groff] refer, mom and inline references

2013-08-13 Thread Peter Schaffter
Robin --

On Tue, Aug 13, 2013, Robin Haberkorn wrote:
> > At the top of your file,
> >
> >   .R1
> > label "(A.n|Q) ', ' D.y"
> > bracket-label " (" ")\c" ""
> > join-authors ", and " ", " ", and "
> > reverse A1
> > sort A1Q1T1B1E1
> > database 
> >   .R2
> >
> > With this setup, references entered without a preceding .REF are
> > inserted into running text.  For example,
> >
> >   end of sentence
> >   .[
> >   keywords
> >   .]
> >   \&. A new sentence.
> >
> Works like a charm, thanks!

When I was re-writing the mom/refer documentation (now done,
CVS committed, and online), I came across a refer command that
simplifies things even further.  (The refer manpage is so terse that
one can easily miss something, or the significance of it.)  The
command is "move-punctuation", and it obviates the need for \c, and
\& before periods.  Change the refer block, above, to

  .R1
  label "(A.n|Q) ', ' D.y"
  bracket-label " (" ")" ", "
  join-authors ", and " ", " ", and "
  move-punctuation
  reverse A1
  sort A1Q1T1B1E1
  database 
  .R2

With this setup, instead of this:

> >   end of sentence
> >   .[
> >   [ keywords
> >   .], p. 168)\c
> >   \&. A new sentence...
> >

you can simply enter

  end of sentence.
  .[
  [ keywords
  .], p. 168)
  A new sentence...

IOW, wordspace and correct placement of punctuation in the text is
taken care of automatically.  This should ease things for you
considerably.  When it comes time to output the bibliography,

  .BIBLIOGRAPHY
  .[
  $LIST$
  .]
  .BIBLIOGRAPHY end

is all that's required.

-- 
Peter Schaffter
http://www.schaffter.ca



Re: [Groff] refer, mom and inline references

2013-08-13 Thread Robin Haberkorn
Hello Peter,

2013/8/11 Peter Schaffter :
> ...
> At the top of your file,
>
>   .R1
> label "(A.n|Q) ', ' D.y"
> bracket-label " (" ")\c" ""
> join-authors ", and " ", " ", and "
> reverse A1
> sort A1Q1T1B1E1
> database 
>   .R2
>
> With this setup, references entered without a preceding .REF are
> inserted into running text.  For example,
>
>   end of sentence
>   .[
>   keywords
>   .]
>   \&. A new sentence.
>
Works like a charm, thanks!

> will produce "end of sentence (author's last name, date). A new
> sentence."
>
> To add a page or page-range number
>
>   end of sentence
>   .[
>   [ keywords
>   .], p. 168)\c
>   \&. A new sentence.
>
> will produce "end of sentence (author's last name, date, p. 168). A
> new sentence."
>
Now I see why there are bracket flags :-)

>
> is all that's required.  There's no need for an additional refer
> block.
>
> Hope this helps.
>
Yes, that works very well.
I wonder why I thought I'd need custom .]- and .][ macros since refer
inserts the labels just fine on its own.
Turns out, the \c at the EOL before my citation blocks somehow
suppressed the entire label automatically inserted by refer.
Strange groff world...

Best regards,
Robin



Re: [Groff] refer, mom and inline references

2013-08-10 Thread Peter Schaffter
Robin --

I'm glad you spotted the problem with inserting parenthetical
references into text.

Originally, mom's refer handling allowed for complete
bibliography-style insertion of parenthetical references, which
necessitated the .REF_STYLE and .REF( ... .REF) macros.  When I
revamped the refer handling to pure MLA, these macros ceased to
be necessary (or even function properly) because the refer block
commands 'label' and 'bracket-label' proved better suited for
formatting parenthetical references and accumulating them for output
with .BIBLIOGRAPHY.

I neglected, however, to update the documentation--which oversight
you've now brought to my attention.

On Fri, Aug 09, 2013, Robin Haberkorn wrote:
> I have now found an ugly solution that works with -mom.

Your solution looks a bit complicated for the purpose.  A
demonstration of a simpler way to set up parenthetical references
follows.  The documentation will reflect this when I rewrite it.

At the top of your file,

  .R1
label "(A.n|Q) ', ' D.y"
bracket-label " (" ")\c" "" 
join-authors ", and " ", " ", and "
reverse A1
sort A1Q1T1B1E1
database 
  .R2

With this setup, references entered without a preceding .REF are
inserted into running text.  For example,

  end of sentence
  .[
  keywords
  .]
  \&. A new sentence.

will produce "end of sentence (author's last name, date). A new
sentence."

To add a page or page-range number

  end of sentence
  .[
  [ keywords
  .], p. 168)\c
  \&. A new sentence.

will produce "end of sentence (author's last name, date, p. 168). A
new sentence."

The '\c' is required.  The first line of text after references of
either sort are entered the same way as first lines of text after
footnotes and endnotes (see the documentation).

To generate a bibliography of the cited works,

  .BIBLIOGRAPHY
  .[
  $LIST$ 
  .]
  .BIBLIOGRAPHY off

is all that's required.  There's no need for an additional refer
block.

Hope this helps.

-- 
Peter Schaffter
http://www.schaffter.ca



Re: [Groff] refer, mom and inline references

2013-08-09 Thread Peter Schaffter
Robin --

On Fri, Aug 09, 2013, Robin Haberkorn wrote:
> I have now found an ugly solution that works with -mom.
> I use something like this near the top of my document:

I'm horribly busy right now so I haven't time to look into this
closely.  However, your ugly solution is pretty much how you have to
tackle the problem when using -mom.

Briefly, with three or four commonly-used formatting styles for
citations and references (MLA, APA, Chicago, etc), and users having
their own particular needs, there's only so much a macro set can do
before one has to manipulate things at the refer level, which is
what your solution does.

I'll get back on this as soon as I have a few free hours.

-- 
Peter Schaffter
http://www.schaffter.ca



Re: [Groff] refer, mom and inline references

2013-08-09 Thread Robin Haberkorn
2013/8/9 jjbrioist :
> Le vendredi 09 août 2013 à 17:35 +0200, Robin Haberkorn a écrit :
> Hello Robin,
>
> I was facing the same issue as you, although I am using -ms for the time.
> I use the -S option to get inline references.
>
> Assume you have the following entry in your
> xxx.bib file :
>
> %A John Robert
> %T Measuring steel bar tension using X-rays
> %D 1993
> %K X-rays dynamometer steel
> %L Steel Res. 35
> %R Steel Res.
> %N 35
> %I Springer
> %C Cleveland
>
>
> and your text reads something like
>
> .BD
> Lately my life
>  .[[
> Robert
>  .]]
> has become more complicated.
> .R
> .DE
> .LP
>
> (take care of the double brackets). Compile this with
>
>> refer -pxxx.bib -e -S thesis.ms > aux.ms
>> groff -ms aux.ms > thesis.ps
>

Hello Jean,

I wonder how this could work. Perhaps -ms implementations of ]- and ][
do the label insertion appropriately.
The manual refer preprocessing however is definitely not necessary
since refer -S is just a short cut to defining a label string (you
could embed that in .R1/.R2 sections).

I have now found an ugly solution that works with -mom.
I use something like this near the top of my document:

.R1
# this extracts the last name of the first author and the publication date
label A.nD.y
database biblio.ref
.R2
\# Save Mom's version of ]- and ][
.rn ]- MOM-REFER-BEGIN
\# Provide my own versions: the brackets are inserted automatically so
you don't need
\# .[[ and .]] or "[]" in the flags field
\# \f(SC merely sets a small-caps font
\# [F contains the label as generated by refer
.ds ]- [\f(SC\\*([F\fP]\c
.rn ][ MOM-REFER-END
.ds ][

References can then be inserted without mom's .REF macros:
.[
whatever
.]

And to generate the bibliography I do:

\# restore mom's ]- and ][
.rn MOM-REFER-BEGIN ]-
.rn MOM-REFER-END ][
.
.BIBLIOGRAPHY
.BIBLIOGRAPHY_TYPE LIST
.R1
no-label-in-text
no-label-in-reference
sort A1Q1T1B1E1
reverse A1
bibliography biblio.ref
.R2
.BIBLIOGRAPHY OFF

So while for ordinary inline references I did the formatting with
custom macros, in the bibliography I let mom do it.
The entire database (biblio.ref) is inserted by refer, which is fine
as long as I do not have a real database (with lots of entries) but
one that contains only the publications I have ever referred to in the
main body of the text.

regards,
Robin



Re: [Groff] refer, mom and inline references

2013-08-09 Thread jjbrioist
Le vendredi 09 août 2013 à 17:35 +0200, Robin Haberkorn a écrit :
> Hello,
> 
> I know a lot has been written on this mailing list about refer and its
> mom integration.
> However, I still don't quite get it.
> Currently I'm writing my bachelor thesis in groff -mom. It was
> relatively easy to imitate the LaTex template they were providing,
> including Computer Modern fonts and so on but I'm still struggling
> with refer.
> I would like to have inline references in an abbreviated form (like
> [AUTHORYEAR]) and a bibliography with all references automatically
> collected.
> (...)
> 

Hello Robin,

I was facing the same issue as you, although I am using -ms for the time.
I use the -S option to get inline references. 

Assume you have the following entry in your 
xxx.bib file : 

%A John Robert
%T Measuring steel bar tension using X-rays 
%D 1993
%K X-rays dynamometer steel
%L Steel Res. 35
%R Steel Res.
%N 35
%I Springer 
%C Cleveland


and your text reads something like

.BD
Lately my life
 .[[
Robert
 .]]
has become more complicated.
.R
.DE
.LP 

(take care of the double brackets). Compile this with

> refer -pxxx.bib -e -S thesis.ms > aux.ms
> groff -ms aux.ms > thesis.ps

This should yield :

"Lately my life [Robert 1993] has become more complicated."

I hope this works fine with -mom.

Yours,

JJ.






[Groff] refer, mom and inline references

2013-08-09 Thread Robin Haberkorn
Hello,

I know a lot has been written on this mailing list about refer and its
mom integration.
However, I still don't quite get it.
Currently I'm writing my bachelor thesis in groff -mom. It was
relatively easy to imitate the LaTex template they were providing,
including Computer Modern fonts and so on but I'm still struggling
with refer.
I would like to have inline references in an abbreviated form (like
[AUTHORYEAR]) and a bibliography with all references automatically
collected.

As I understand mom's refer support and as I was able to verify it,
mom provides the following possibilities:
 * footnote references
 * endnote references
 * inline references
 * bibliographies

When I use endnote references, mom will merely insert a small
superscript number into the running text.
When I use inline references my references are put inline with no
apparent way of customizing the inline citation style.
When I use a .BIBLIOGRAPHY and refer's "accumulate" option, my
references are neatly accumulated into the bibliography but no longer
occur inline, neither with .REF, nor with .REF[. I guess this has
something to do with refer no longer emitting the start/end reference
macros and string definitions for mom to format.

Any pointers on how to achieve what I want?

Would I be able to at least get automatically formatted inline
references in the [AUTHORYEAR] style using refer's label feature with
a *manually* populated bibliography?
I guess I would have to write custom .[- and .][ macros and bypass
mom's .REF macros altogether.

Best regards,
Robin