[NTG-context] How to Centre Multi-line Verbatim Text

2015-03-13 Thread Emmanuel Asante
Hello All,

I am trying to centre a multi-line verbatim text horizontally on the page
but I cannot figure out how to do that. With the code below how can I
centre the whole block horizontally on the page?

\setuptyping[TEX]

\startTEX
   RSpec.describe Post, :type = :model do
end
 \stopTEX

Thanks
Emmanuel
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Tables, Row Span, and Colors

2015-03-13 Thread Otared Kavian
 On 14 Mar 2015, at 00:27, Troy Henderson thend...@gmail.com wrote:
 
 Thank you Wolfgang.  The attached PDF is the output I get from using your 
 code.
 
 This is LuaTeX, Version beta-0.79.2 (TeX Live 2015/dev) (rev 5084)

Hi Troy,

With Wolfgang’s code, the attached PDF is what I get with 
ConTeXt  ver: 2015.03.10 12:09 MKIV beta  fmt: 2015.3.11  int: 
english/english
Here it doesn’t show the problem you noticed.
It may happen that the code you used missed something.

Best regards: OK


table-row-span.pdf
Description: Adobe PDF document


___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Tables, Row Span, and Colors

2015-03-13 Thread Troy Henderson
Thank you Wolfgang.  The attached PDF is the output I get from using your
code.

This is LuaTeX, Version beta-0.79.2 (TeX Live 2015/dev) (rev 5084)

Troy


foo.pdf
Description: Adobe PDF document
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] component not included

2015-03-13 Thread Wolfgang Werners-Lucchini
 According toll my observations, you need to reference the needed parts
 inside of the \start... and \stop..., so your product would become:
 
 
 ```
 \startproduct pd-medizin
 \project pj-medizin
 \component test
 \stopproduct
 ```
 
 You also have to restructure the other files, so that \start... is the
 first and \stop... the last command in the files.

Yes! That is the cause. Thank you!

The wiki examples should be corrected to prevent others from this 
error.

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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Tables, Row Span, and Colors

2015-03-13 Thread Wolfgang Schuster

 Am 12.03.2015 um 18:37 schrieb Troy Henderson thend...@gmail.com:
 
 The following code produces my table, but I could not get the text Region 
 to span rows 3-7.  So, I would like
 
 the word Region to be inside the table and not hacked in the way that I 
 have it.
 to make the (spanned) cell containing Years have a gray background.
 to make each of the column heading cells (i.e., the ones containing 1, 
 1-2, ..., 15+, and Total to have a gray background.
 to have the (spanned) cell containing Region (from #1) have a gray 
 background.
 to have the row heading cells (i.e., the ones containing East, Midwest, 
 South, West, and Total) have a gray background.
 I would appreciate any help in attaining this wish list.
 
You can use natural tables or xtables to achieve this layout.

\starttext

\startsetups[table:layout]
\setupTABLE [start]  
[frame=off,leftframe=on,rightframe=on,align=flushright,width=4em,loffset=.25em,roffset=.25em]
\setupTABLE [y]   [1,2]  
[foregroundstyle=bold,background=screen,align=middle,frame=on]
\setupTABLE [x]   [1,2]  
[foregroundstyle=bold,background=screen,frame=on]
\setupTABLE [1,2] [1,2]  
[background=,frame=off,leftframe=off,rightframe=off]
\setupTABLE [x]   [1][align={middle,lohi},width=2em]
\setupTABLE [x]   [2][align=flushleft,width=6em]
\setupTABLE [y]   [last] [frame=on]
\stopsetups

\bTABLE[setups=table:layout]
\bTR
\bTD \eTD
\bTD \eTD
\bTD[nx=7] Years \eTD
\eTR
\bTR
\bTD \eTD
\bTD \eTD
\bTD \m{1} \eTD
\bTD \m{1-2} \eTD
\bTD \m{3-4} \eTD
\bTD \m{5-9} \eTD
\bTD \m{10-14} \eTD
\bTD \m{15+} \eTD
\bTD Total \eTD
\eTR
\bTR
\bTD[ny=5] \rotate[rotation=90]{Region} \eTD
\bTD East \eTD
\bTD 32 \eTD
\bTD 54 \eTD
\bTD 59 \eTD
\bTD 112 \eTD
\bTD 77 \eTD
\bTD 118 \eTD
\bTD 452 \eTD
\eTR
\bTR
\bTD Midwest \eTD
\bTD 31 \eTD
\bTD 68 \eTD
\bTD 68 \eTD
\bTD 120 \eTD
\bTD 63 \eTD
\bTD 173 \eTD
\bTD 523 \eTD
\eTR
\bTR
\bTD South \eTD
\bTD 53 \eTD
\bTD 92 \eTD
\bTD 93 \eTD
\bTD 158 \eTD
\bTD 106 \eTD
\bTD 158 \eTD
\bTD 660 \eTD
\eTR
\bTR
\bTD West \eTD
\bTD 41 \eTD
\bTD 56 \eTD
\bTD 67 \eTD
\bTD 78 \eTD
\bTD 45 \eTD
\bTD 86 \eTD
\bTD 373 \eTD
\eTR
\bTR
\bTD Total \eTD
\bTD 157 \eTD
\bTD 270 \eTD
\bTD 287 \eTD
\bTD 468 \eTD
\bTD 291 \eTD
\bTD 535 \eTD
\bTD 2008 \eTD
\eTR
\eTABLE

\stoptext

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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-13 Thread Jörg Weger
After putting the definition you proposed last in front of my minimal 
example in mkiv beta 2015.02.03 it worked once and then not any more. I 
also tried to remove all auxiliary files after a new pass.


But today I installed beta 2015.03.10 (complete fresh install as I keep 
the older version in a renamed folder) and now the MWE with your extra 
code renders repeatedly correct.


So this seems to be a workaround until you rewrite “write” as you said.

I will experiment further with tikz’ ‘remember’ picture mode.


Greetings Jörg

 START MWE %

%D %%% Hans’ redefinition of write function: %%%

\def\syst_write#1#2%
  {\ctxcommand{write(\number#1,\!!bs\normalunexpanded{#2}\!!es)}}

\unexpanded\def\writeviatex#1#2%
  {\ifx\normalwrite\relax\else
 \normalwrite#1{#2}%
   \fi}

%%

\usemodule[tikz]

\usetikzlibrary[shapes.misc,arrows]

\starttext

\tikz[baseline,remember picture] \node[rounded 
rectangle,draw,anchor=text] (n1) {this};

belongs to
\tikz[baseline,remember picture] \node[rounded 
rectangle,draw,anchor=text] (n2) {that};


\starttikzpicture
[remember picture,overlay]
\draw[-] (n1.north) to [bend left] (n2.north);
\stoptikzpicture

\stoptext

 STOP MWE %%



On 08.03.2015 23:17, Hans Hagen wrote:

On 3/8/2015 7:07 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 18:39 schrieb Hans Hagen pra...@wxs.nl:

On 3/8/2015 1:04 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 12:55 schrieb Hans Hagen pra...@wxs.nl
mailto:pra...@wxs.nl:

On 3/8/2015 12:26 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 11:11 schrieb Hans Hagen pra...@wxs.nl
mailto:pra...@wxs.nl
mailto:pra...@wxs.nl:

this should help:

\unexpanded\def\writeviatex#1#2%
{\ifx\normalwrite\relax\else
  % the \detokenize makes sure we don't expand \noexpanded macros
   \normalwrite#1{\detokenize{#2}}%
\fi}

(in future version i might replace write completely)


Only partially because the saved positions from \pdfsavepos are
wrong.


in what sense wrong?


Content of the external file from MkIV (the entries on the first
page show 0
and the values on page 2 and 3 are always the same):

1:0:0
2:0:0
3:4661756:45255023
4:4661756:45255023
5:4661756:45255023
6:4661756:45255023

Content of the external file from MkII (different values for the first
and second position on each page):

1:6526435:46204089
2:4661756:45256000
3:6526435:46204089
4:4661756:45256000
5:6526435:46204089
6:4661756:45256000


ypositions can differ a bit because we use different fonts and so
does the interlinespace


But the values for both positions should be different which isn’t the
case for MkIV
and the first page saves 0 for the x and y positions.


It's a side effect of expansion at the wrong time (where such primitives
can return wrong values but at least they return something) but
something like this works:

\def\syst_write#1#2%
   {\ctxcommand{write(\number#1,\!!bs\normalunexpanded{#2}\!!es)}}

\unexpanded\def\writeviatex#1#2%
   {\ifx\normalwrite\relax\else
  \normalwrite#1{#2}%
\fi}





___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-13 Thread Wolfgang Schuster

 Am 13.03.2015 um 14:17 schrieb Jörg Weger joerg73@googlemail.com:
 
 After putting the definition you proposed last in front of my minimal example 
 in mkiv beta 2015.02.03 it worked once and then not any more. I also tried to 
 remove all auxiliary files after a new pass.
 
 But today I installed beta 2015.03.10 (complete fresh install as I keep the 
 older version in a renamed folder) and now the MWE with your extra code 
 renders repeatedly correct.
 
 So this seems to be a workaround until you rewrite “write” as you said.
 
 I will experiment further with tikz’ ‘remember’ picture mode.

1. The current beta has a fix for the \write command and you don’t need Hans 
patch.

2. Commands with a _ in the name, e.g. \syst_write can only be used when you 
place them
   in a group which starts with \unprotect and ends with \protect.

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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] \placefootnotes at the end of each chapter, conditionally

2015-03-13 Thread Alan BRASLAU
On Thu, 12 Mar 2015 22:59:33 +0100
Hans Hagen pra...@wxs.nl wrote:

  Supplementary question, just for fun:
  how to specify title=Footnote if there is only one?  
 
 \startsetups chapter:after
  \ifcase\rawcountervalue[footnote]\relax
  \or
  \startsubject[title=Footnote]
  \placefootnotes
  \stopsubject
  \else
  \startsubject[title=Footnotes]
  \placefootnotes
  \stopsubject
  \fi
 \stopsetups
 
 \setupnotes[location=none]
 \setupnotation[way=bychapter]
 
 \setuphead[chapter][aftersection=\setups{chapter:after}]
 
 \starttext
  \dorecurse{4}{
  \startchapter[title=Number #1]
  A few notes\dorecurse{\numexpr#1-1\relax}{\footnote{Note 
 #1.##1}}.
  \stopchapter
  }
 \stoptext


I knew that it would be something as easy as that...

Wikified:
http://wiki.contextgarden.net/Footnotes

Alan
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___