ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* stretching smallcaps with a style command
@ 2008-11-14 15:24 Bob Reynolds
  2008-11-17  8:43 ` Taco Hoekwater
  0 siblings, 1 reply; 4+ messages in thread
From: Bob Reynolds @ 2008-11-14 15:24 UTC (permalink / raw)
  To: ntg-context

Hello Everyone:

I'm an intermediate-skilled user trying to typeset notes for my CompTIA A+ certification course with ConTeXt, but I'm having trouble with styling abbreviations. I would like to letterspace (I think that is a correct typographical term, I'm a little new at typesetting, sorry) and smallcap my dozens of abbreviations, and I can get it to work manually but not with \setupsynonyms. Googling the wiki, mailing lists, etc. didn't help and I'm not enough of a TeX programmer to understand the definitions in the source code in this case. I run TeXLive 2008 on Gentoo Linux with ConTeXt version:

CtxTools | context version: 2008.05.21 15:21 (/usr/share/texmf-dist/tex/context/base/context.tex)
CtxTools | context version: 2008.05.21 15:21 (/usr/share/texmf-dist/tex/context/base/cont-new.tex)

http://live.contextgarden.net/ doesn't seem to be working for anything at the moment, so I don't know if it works there or not. Below is a small sample input I made to illustrate my attempts; I tried to make it as transparent as possible. I would greatly appreciate any help.

Thank You Very Much,
Bob



\setupcolor [hex]
\definecolor [LightBlue] [h=8080FF]
\setupcolors [state=start]

\setupbodyfont [10pt]
\setupcapitals [sc=yes]

\def\stretchedspaceamount {.1em}
\define [1] \StretchedSmallCaps {\smallcaps {\stretchedlowercase {#1}}}
\define \Term {\color [LightBlue]}

% \setupsynonyms [abbreviation] [textstyle=\StretchedSmallCaps] % I would like this to work, but it doesn't
% \setupsynonyms [abbreviation] [textstyle=\italic] % other commands like this work
\abbreviation {CPU} {central processing unit}


\starttext

\Term {\StretchedSmallCaps {CPU}} = \Term {\infull {CPU}} % this produces the output that I want

\Term {\smallcaps {\lowercase {CPU}}} = \Term {\infull {CPU}} % this is what it looks like without stretching

\Term {\CPU} = \Term {\infull {CPU}} % this is what I want to type to produce the stretched, smallcaps output

\stoptext


      
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: stretching smallcaps with a style command
  2008-11-14 15:24 stretching smallcaps with a style command Bob Reynolds
@ 2008-11-17  8:43 ` Taco Hoekwater
  0 siblings, 0 replies; 4+ messages in thread
From: Taco Hoekwater @ 2008-11-17  8:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users



Bob Reynolds wrote:
> 

> \define [1] \StretchedSmallCaps {\smallcaps {\stretchedlowercase {#1}}}

You need a more low-level definition of this command because
of macro expansion issues inside the logo processing.
It works fine with this:

   \unexpanded\def\StretchedSmallCaps#1%
       {\smallcaps {\stretchedlowercase {#1}}}

It is not easy to explain why precisely this is needed, so I am not
going to try :-)

Best wishes,
Taco


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: stretching smallcaps with a style command
  2008-11-19 11:40 Bob Reynolds
@ 2008-11-20  8:56 ` Taco Hoekwater
  0 siblings, 0 replies; 4+ messages in thread
From: Taco Hoekwater @ 2008-11-20  8:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users



Bob Reynolds wrote:
> I can define the abbreviation fine, and I can use the \infull version
> of it fine, but I can't use the command version at all. Another
> example: \ATX12V. I've been working around it by defining both
> synonyms and a logo like \PSTwo which typesets like I want \PS/2 to
> typeset, but what is a more elegent way of doing this that doesn't
> involve definining two different commands? I don't know how to change
> catcodes, despite numerous failed attempts to do just that with
> commands like \unprotect \catcode`2=\@@letter \protect.

Changing the catcode of digits is a bad idea because you are likely
to run into problems elsewhere (like in section headings etc.). The
cleanest solution is to use a small dedicated macro to call the
abbreviated version with:

  \logo [PS/2] [Play School Halved]

  \unexpanded\def\abbr#1{\getvalue{#1}}

  \starttext
  \abbr{PS/2}
  \stoptext

That takes a bit more typing, but is much safer and will work regardless
of the current catcode values.

Best wishes,
Taco


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: stretching smallcaps with a style command
@ 2008-11-19 11:40 Bob Reynolds
  2008-11-20  8:56 ` Taco Hoekwater
  0 siblings, 1 reply; 4+ messages in thread
From: Bob Reynolds @ 2008-11-19 11:40 UTC (permalink / raw)
  To: ntg-context

Just to let anyone know who's interested, I more or less solved this problem with the (more or less undocumented) command \definealternativestyle [StretchedSmallCaps] [\StretchedSmallCaps] [\StretchedSmallCaps]. It allows me to set \setupsynonyms [abbreviation] [textstyle=StretchedSmallCaps, criterium=all], which essentially works. Is this generally applicable enough to put on the wiki somewhere?

I now have another abbreviations question. What is the easiest way to allow digits (and, ideally, the forward slash) in abbreviation names (i.e. be able to type \PS/2 and not get the error "\PS is undefined")? This occurs quite commonly, particularly with numbers. I can define the abbreviation fine, and I can use the \infull version of it fine, but I can't use the command version at all. Another example: \ATX12V. I've been working around it by defining both synonyms and a logo like \PSTwo which typesets like I want \PS/2 to typeset, but what is a more elegent way of doing this that doesn't involve definining two different commands? I don't know how to change catcodes, despite numerous failed attempts to do just that with commands like \unprotect \catcode`2=\@@letter \protect.

Thanks,
Bob




----- Original Message ----
From: Bob Reynolds <trillia9@yahoo.com>
To: ntg-context@ntg.nl
Sent: Friday, November 14, 2008 10:24:26 AM
Subject: stretching smallcaps with a style command

Hello Everyone:

I'm an intermediate-skilled user trying to typeset notes for my CompTIA A+ certification course with ConTeXt, but I'm having trouble with styling abbreviations. I would like to letterspace (I think that is a correct typographical term, I'm a little new at typesetting, sorry) and smallcap my dozens of abbreviations, and I can get it to work manually but not with \setupsynonyms. Googling the wiki, mailing lists, etc. didn't help and I'm not enough of a TeX programmer to understand the definitions in the source code in this case. I run TeXLive 2008 on Gentoo Linux with ConTeXt version:

CtxTools | context version: 2008.05.21 15:21 (/usr/share/texmf-dist/tex/context/base/context.tex)
CtxTools | context version: 2008.05.21 15:21 (/usr/share/texmf-dist/tex/context/base/cont-new.tex)

http://live.contextgarden.net/ doesn't seem to be working for anything at the moment, so I don't know if it works there or not. Below is a small sample input I made to illustrate my attempts; I tried to make it as transparent as possible. I would greatly appreciate any help.

Thank You Very Much,
Bob



\setupcolor [hex]
\definecolor [LightBlue] [h=8080FF]
\setupcolors [state=start]

\setupbodyfont [10pt]
\setupcapitals [sc=yes]

\def\stretchedspaceamount {.1em}
\define [1] \StretchedSmallCaps {\smallcaps {\stretchedlowercase {#1}}}
\define \Term {\color [LightBlue]}

% \setupsynonyms [abbreviation] [textstyle=\StretchedSmallCaps] % I would like this to work, but it doesn't
% \setupsynonyms [abbreviation] [textstyle=\italic] % other commands like this work
\abbreviation {CPU} {central processing unit}


\starttext

\Term {\StretchedSmallCaps {CPU}} = \Term {\infull {CPU}} % this produces the output that I want

\Term {\smallcaps {\lowercase {CPU}}} = \Term {\infull {CPU}} % this is what it looks like without stretching

\Term {\CPU} = \Term {\infull {CPU}} % this is what I want to type to produce the stretched, smallcaps output

\stoptext


      
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-11-20  8:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-14 15:24 stretching smallcaps with a style command Bob Reynolds
2008-11-17  8:43 ` Taco Hoekwater
2008-11-19 11:40 Bob Reynolds
2008-11-20  8:56 ` Taco Hoekwater

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).