ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* font modification in \inright
@ 2007-11-25 22:58 Boris Dagaev
  2007-11-26  1:03 ` Boris Dagaev
  2007-11-26  5:37 ` Thomas A. Schmitz
  0 siblings, 2 replies; 5+ messages in thread
From: Boris Dagaev @ 2007-11-25 22:58 UTC (permalink / raw)
  To: ntg-context

Hello ConTeXt Experts!

I am looking for a proper ConTeXt of solving a problem I've solved
through a hack (my solution is right after the need and problem are
stated below).

Preface: I am learning ConTeXt as I go. I do apologize if mine is a
rookie question. I'd appreciate your help very much.

Need:
number every paragraph and place its number on the right margin in a
smaller (6pt) font.

Problem:
when I try to switch to a smaller font directly in an \inright:
\inright{\vi\hfill\bf\the\parCount}
that outputs the count in the main paragraph font (14pt) until I
prefix every paragraph with a hack
{\vi\ \setbox0=\hbox{\ }\kern-\wd0}
then \inright outputs the number correctly in a 6pt font
(if I add the hack to \everypar, the inright font is still 14pt)

Question: is there a way to switch to a smaller font directly in \inright{}?

My solution:

\setupoutput[pdftex]

\definepapersize[MYBOOK][width=10.5cm,height=18.5cm]
\setuppapersize[MYBOOK][letter]
\setuplayout[width=fit, height=fit, topspace=0cm, header=1cm,
footer=0.2cm, location=middle, marking=on, leftmargin=0cm,
leftmargindistance=0cm, rightmargin=0.5cm, rightmargindistance=0cm,
leftdistance=0cm, rightdistance=0cm, backspace=0cm]

\setupbodyfont[14pt]
\setupwhitespace[big]

\setupinmargin[align=right]

\newcount\parCount \parCount=1

\def\inRightParCount{%
  %% ADDING THE HACK HERE DOES NOT HELP {\vi\ \setbox0=\hbox{\ }\kern-\wd0}
  \inright{\hfill\bf\the\parCount}
  \global\advance\parCount by 1 }

\appendtoks \inRightParCount \to \everypar

\starttext

{\vi\ \setbox0=\hbox{\ }\kern-\wd0}Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. In arcu justo, iaculis eu, adipiscing
nec, lacinia a, eros. Proin consequat, nisl eu commodo dignissim,
dolor sapien facilisis turpis, vitae mattis felis sapien ac enim.
Donec nisi. Pellentesque nec enim. Vestibulum dignissim tincidunt
eros. Proin pretium elit sed mi. Aenean eu magna. Integer elementum
mollis nibh. Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas. Nam nisi. Praesent feugiat est.
Duis pharetra cursus orci. Fusce pede. Donec vitae nunc eget mauris
condimentum sagittis.

% WITHOUT THE HACK THE PARCOUNT IS IN 14pt
% {\vi\ \setbox0=\hbox{\ }\kern-\wd0}
Nunc vel ipsum. Fusce posuere. Praesent id sem in mi gravida molestie.
Proin ultrices leo eget enim. Pellentesque faucibus, massa in aliquet
mollis, turpis neque sollicitudin tortor, sed bibendum velit est id
risus. Duis at massa. Curabitur euismod cursus libero. Integer
pharetra, nisl eu laoreet sodales, sem lorem fermentum enim, in
euismod odio velit at pede. Sed eget dui. Curabitur vitae turpis ut
velit sollicitudin venenatis. Phasellus vel lectus. Nullam mi sapien,
varius congue, imperdiet vitae, aliquet eget, orci. Donec purus.

{\vi\ \setbox0=\hbox{\ }\kern-\wd0}Vivamus ut metus. Mauris ac. Aenean
urna sem, interdum id, pellentesque ut, tincidunt vitae, magna. Morbi
facilisis purus sit amet nisi. Quisque eleifend egestas ante. Vivamus
eleifend sollicitudin ipsum. Praesent et tortor vestibulum dui aliquet
accumsan. Vestibulum massa mauris, tristique sit amet, hendrerit
vitae, euismod a, magna. Nulla erat. Maecenas tincidunt. Lorem ipsum
dolor sit amet, consectetuer adipiscing elit. Curabitur sit amet pede.
Phasellus pretium sagittis metus.

\stoptext


Thank you,
Boris
___________________________________________________________________________________
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] 5+ messages in thread

* Re: font modification in \inright
  2007-11-25 22:58 font modification in \inright Boris Dagaev
@ 2007-11-26  1:03 ` Boris Dagaev
  2007-11-26  5:37 ` Thomas A. Schmitz
  1 sibling, 0 replies; 5+ messages in thread
From: Boris Dagaev @ 2007-11-26  1:03 UTC (permalink / raw)
  To: ntg-context

Quick addenda.

I attempted to read the code in page-mar.tex and tried

\def\inRightParCount{%
  \inrightedge{\vi\bf\the\parCount}
  \global\advance\parCount by 1 }

instead of

\def\inRightParCount{%
  \inright{\vi\hfill\bf\the\parCount}
  \global\advance\parCount by 1 }

and the former worked just fine - the font got smaller in the right
margin and the text was aligned to the right.

Although the original problem appears to be solved, still, I would
greatly appreciate if someone explained to me why \inright does not
seem to pay any attention to \vi whereas \inrightedge does.

Thank you!

Boris


On Nov 25, 2007 5:58 PM, Boris Dagaev <boris.dagaev@gmail.com> wrote:
> Hello ConTeXt Experts!
>
> I am looking for a proper ConTeXt of solving a problem I've solved
> through a hack (my solution is right after the need and problem are
> stated below).
>
> Preface: I am learning ConTeXt as I go. I do apologize if mine is a
> rookie question. I'd appreciate your help very much.
>
> Need:
> number every paragraph and place its number on the right margin in a
> smaller (6pt) font.
>
> Problem:
> when I try to switch to a smaller font directly in an \inright:
> \inright{\vi\hfill\bf\the\parCount}
> that outputs the count in the main paragraph font (14pt) until I
> prefix every paragraph with a hack
> {\vi\ \setbox0=\hbox{\ }\kern-\wd0}
> then \inright outputs the number correctly in a 6pt font
> (if I add the hack to \everypar, the inright font is still 14pt)
>
> Question: is there a way to switch to a smaller font directly in \inright{}?
>
> My solution:
>
> \setupoutput[pdftex]
>
> \definepapersize[MYBOOK][width=10.5cm,height=18.5cm]
> \setuppapersize[MYBOOK][letter]
> \setuplayout[width=fit, height=fit, topspace=0cm, header=1cm,
> footer=0.2cm, location=middle, marking=on, leftmargin=0cm,
> leftmargindistance=0cm, rightmargin=0.5cm, rightmargindistance=0cm,
> leftdistance=0cm, rightdistance=0cm, backspace=0cm]
>
> \setupbodyfont[14pt]
> \setupwhitespace[big]
>
> \setupinmargin[align=right]
>
> \newcount\parCount \parCount=1
>
> \def\inRightParCount{%
>  %% ADDING THE HACK HERE DOES NOT HELP {\vi\ \setbox0=\hbox{\ }\kern-\wd0}
>  \inright{\hfill\bf\the\parCount}
>  \global\advance\parCount by 1 }
>
> \appendtoks \inRightParCount \to \everypar
>
> \starttext
>
> {\vi\ \setbox0=\hbox{\ }\kern-\wd0}Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit. In arcu justo, iaculis eu, adipiscing
> nec, lacinia a, eros. Proin consequat, nisl eu commodo dignissim,
> dolor sapien facilisis turpis, vitae mattis felis sapien ac enim.
> Donec nisi. Pellentesque nec enim. Vestibulum dignissim tincidunt
> eros. Proin pretium elit sed mi. Aenean eu magna. Integer elementum
> mollis nibh. Pellentesque habitant morbi tristique senectus et netus
> et malesuada fames ac turpis egestas. Nam nisi. Praesent feugiat est.
> Duis pharetra cursus orci. Fusce pede. Donec vitae nunc eget mauris
> condimentum sagittis.
>
> % WITHOUT THE HACK THE PARCOUNT IS IN 14pt
> % {\vi\ \setbox0=\hbox{\ }\kern-\wd0}
> Nunc vel ipsum. Fusce posuere. Praesent id sem in mi gravida molestie.
> Proin ultrices leo eget enim. Pellentesque faucibus, massa in aliquet
> mollis, turpis neque sollicitudin tortor, sed bibendum velit est id
> risus. Duis at massa. Curabitur euismod cursus libero. Integer
> pharetra, nisl eu laoreet sodales, sem lorem fermentum enim, in
> euismod odio velit at pede. Sed eget dui. Curabitur vitae turpis ut
> velit sollicitudin venenatis. Phasellus vel lectus. Nullam mi sapien,
> varius congue, imperdiet vitae, aliquet eget, orci. Donec purus.
>
> {\vi\ \setbox0=\hbox{\ }\kern-\wd0}Vivamus ut metus. Mauris ac. Aenean
> urna sem, interdum id, pellentesque ut, tincidunt vitae, magna. Morbi
> facilisis purus sit amet nisi. Quisque eleifend egestas ante. Vivamus
> eleifend sollicitudin ipsum. Praesent et tortor vestibulum dui aliquet
> accumsan. Vestibulum massa mauris, tristique sit amet, hendrerit
> vitae, euismod a, magna. Nulla erat. Maecenas tincidunt. Lorem ipsum
> dolor sit amet, consectetuer adipiscing elit. Curabitur sit amet pede.
> Phasellus pretium sagittis metus.
>
> \stoptext
>
>
> Thank you,
> Boris
>
___________________________________________________________________________________
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] 5+ messages in thread

* Re: font modification in \inright
  2007-11-25 22:58 font modification in \inright Boris Dagaev
  2007-11-26  1:03 ` Boris Dagaev
@ 2007-11-26  5:37 ` Thomas A. Schmitz
  2007-11-26 11:07   ` Wolfgang Schuster
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas A. Schmitz @ 2007-11-26  5:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users

This seems to work:


\definebodyfont[6pt][rm][default]

\setupinmargin[align=right,style={\switchtobodyfont[6pt]}]

Nice example, btw!

HTH

Thomas

On Nov 25, 2007, at 11:58 PM, Boris Dagaev wrote:

> Hello ConTeXt Experts!
>
> I am looking for a proper ConTeXt of solving a problem I've solved
> through a hack (my solution is right after the need and problem are
> stated below).
>
> Preface: I am learning ConTeXt as I go. I do apologize if mine is a
> rookie question. I'd appreciate your help very much.
>
> Need:
> number every paragraph and place its number on the right margin in a
> smaller (6pt) font.
>
> Problem:
> when I try to switch to a smaller font directly in an \inright:
> \inright{\vi\hfill\bf\the\parCount}
> that outputs the count in the main paragraph font (14pt) until I
> prefix every paragraph with a hack
> {\vi\ \setbox0=\hbox{\ }\kern-\wd0}
> then \inright outputs the number correctly in a 6pt font
> (if I add the hack to \everypar, the inright font is still 14pt)
>
> Question: is there a way to switch to a smaller font directly in  
> \inright{}?
>
> My solution:
>
> \setupoutput[pdftex]
>
> \definepapersize[MYBOOK][width=10.5cm,height=18.5cm]
> \setuppapersize[MYBOOK][letter]
> \setuplayout[width=fit, height=fit, topspace=0cm, header=1cm,
> footer=0.2cm, location=middle, marking=on, leftmargin=0cm,
> leftmargindistance=0cm, rightmargin=0.5cm, rightmargindistance=0cm,
> leftdistance=0cm, rightdistance=0cm, backspace=0cm]
>
> \setupbodyfont[14pt]
> \setupwhitespace[big]
>
> \setupinmargin[align=right]
>
> \newcount\parCount \parCount=1
>
> \def\inRightParCount{%
>  %% ADDING THE HACK HERE DOES NOT HELP {\vi\ \setbox0=\hbox{\ }\kern- 
> \wd0}
>  \inright{\hfill\bf\the\parCount}
>  \global\advance\parCount by 1 }
>
> \appendtoks \inRightParCount \to \everypar
>
> \starttext
>
> {\vi\ \setbox0=\hbox{\ }\kern-\wd0}Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit. In arcu justo, iaculis eu, adipiscing
> nec, lacinia a, eros. Proin consequat, nisl eu commodo dignissim,
> dolor sapien facilisis turpis, vitae mattis felis sapien ac enim.
> Donec nisi. Pellentesque nec enim. Vestibulum dignissim tincidunt
> eros. Proin pretium elit sed mi. Aenean eu magna. Integer elementum
> mollis nibh. Pellentesque habitant morbi tristique senectus et netus
> et malesuada fames ac turpis egestas. Nam nisi. Praesent feugiat est.
> Duis pharetra cursus orci. Fusce pede. Donec vitae nunc eget mauris
> condimentum sagittis.
>
> % WITHOUT THE HACK THE PARCOUNT IS IN 14pt
> % {\vi\ \setbox0=\hbox{\ }\kern-\wd0}
> Nunc vel ipsum. Fusce posuere. Praesent id sem in mi gravida molestie.
> Proin ultrices leo eget enim. Pellentesque faucibus, massa in aliquet
> mollis, turpis neque sollicitudin tortor, sed bibendum velit est id
> risus. Duis at massa. Curabitur euismod cursus libero. Integer
> pharetra, nisl eu laoreet sodales, sem lorem fermentum enim, in
> euismod odio velit at pede. Sed eget dui. Curabitur vitae turpis ut
> velit sollicitudin venenatis. Phasellus vel lectus. Nullam mi sapien,
> varius congue, imperdiet vitae, aliquet eget, orci. Donec purus.
>
> {\vi\ \setbox0=\hbox{\ }\kern-\wd0}Vivamus ut metus. Mauris ac. Aenean
> urna sem, interdum id, pellentesque ut, tincidunt vitae, magna. Morbi
> facilisis purus sit amet nisi. Quisque eleifend egestas ante. Vivamus
> eleifend sollicitudin ipsum. Praesent et tortor vestibulum dui aliquet
> accumsan. Vestibulum massa mauris, tristique sit amet, hendrerit
> vitae, euismod a, magna. Nulla erat. Maecenas tincidunt. Lorem ipsum
> dolor sit amet, consectetuer adipiscing elit. Curabitur sit amet pede.
> Phasellus pretium sagittis metus.
>
> \stoptext
>
>
> Thank you,
> Boris
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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] 5+ messages in thread

* Re: font modification in \inright
  2007-11-26  5:37 ` Thomas A. Schmitz
@ 2007-11-26 11:07   ` Wolfgang Schuster
  2007-11-26 22:21     ` Boris Dagaev
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2007-11-26 11:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2007/11/26, Thomas A. Schmitz <thomas.schmitz@uni-bonn.de>:
> This seems to work:
>
>
> \definebodyfont[6pt][rm][default]
>
> \setupinmargin[align=right,style={\switchtobodyfont[6pt]}]
>
> Nice example, btw!

Also possible:

\definefont[MarginFont][Serif at 6pt]
\setupinmargin[style=MarginFont]

Wolfgang
___________________________________________________________________________________
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] 5+ messages in thread

* Re: font modification in \inright
  2007-11-26 11:07   ` Wolfgang Schuster
@ 2007-11-26 22:21     ` Boris Dagaev
  0 siblings, 0 replies; 5+ messages in thread
From: Boris Dagaev @ 2007-11-26 22:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thomas, Wolfgang,
Thank you very much!! Much cleaner now.

P.S. Still can't figure out why \inright and \inrightmargin behave
differently with respect to \vii (and such)... A lot to learn... a lot
to learn...


On Nov 26, 2007 6:07 AM, Wolfgang Schuster
<schuster.wolfgang@googlemail.com> wrote:
> 2007/11/26, Thomas A. Schmitz <thomas.schmitz@uni-bonn.de>:
> > This seems to work:
> >
> >
> > \definebodyfont[6pt][rm][default]
> >
> > \setupinmargin[align=right,style={\switchtobodyfont[6pt]}]
> >
> > Nice example, btw!
>
> Also possible:
>
> \definefont[MarginFont][Serif at 6pt]
> \setupinmargin[style=MarginFont]
>
> Wolfgang
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>
___________________________________________________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2007-11-26 22:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-25 22:58 font modification in \inright Boris Dagaev
2007-11-26  1:03 ` Boris Dagaev
2007-11-26  5:37 ` Thomas A. Schmitz
2007-11-26 11:07   ` Wolfgang Schuster
2007-11-26 22:21     ` Boris Dagaev

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).