ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Cross references to column numbers
@ 2019-08-12 13:26 Oliver von Criegern
  2019-09-02 16:46 ` Oliver von Criegern
  0 siblings, 1 reply; 12+ messages in thread
From: Oliver von Criegern @ 2019-08-12 13:26 UTC (permalink / raw)
  To: ntg-context

Dear list members,

how can I create cross references to column numbers?

I have a two column layout with column numbers in the header instead of 
page numbers (actually, these column numbers are calculated from the 
page numbers). Now I want to create a cross reference that returns the 
column number of the target. How can I achieve this?

Of course, I can get the page number with \pagereference (for the 
target) and \at (for the reference), but for calculating the column 
number (according to what I did in the header), I would also need to 
know whether the target is in the left or in the right column, and I 
can't see how I can get this information.

For an example, see the question posted by me at stackexchange:
https://tex.stackexchange.com/questions/502944/context-cross-references-to-column-numbers

Besides, I am wondering, regarding the generally very regular and 
consistent naming of commands in ConTeXt, why this is not so in the case 
of references. For example, to refer to a page, I need \pagereference 
(for the target) and \at (for the reference); to refer to a line, I need 
\someline (for the target) and \inline (for the reference), but only if 
I want it to automatically add the word "line" or something else before 
the number, otherwise I have to use \inlinerange. It took me some time 
to find that out. Wouldn't it be easier to have just one command for the 
target and another one for the reference, and everything else, as 
counters and headers to be returned, text to be added etc. to be 
configured by options?

Best regards,
Oliver.


___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Cross references to column numbers
  2019-08-12 13:26 Cross references to column numbers Oliver von Criegern
@ 2019-09-02 16:46 ` Oliver von Criegern
  2019-09-09 20:05   ` Henri Menke
  0 siblings, 1 reply; 12+ messages in thread
From: Oliver von Criegern @ 2019-09-02 16:46 UTC (permalink / raw)
  To: ntg-context

Dear list members,

is there any way to get a cross reference to a column in a two column 
layout?

At least, I would need to get some value that tells me whether the 
target is in the left or in the right column. How to achieve this?

This is the more simplified version of the my previous question cited below.

Best regards,
Oliver.


Am 12.08.19 um 15:26 schrieb Oliver von Criegern:
> Dear list members,
>
> how can I create cross references to column numbers?
>
> I have a two column layout with column numbers in the header instead 
> of page numbers (actually, these column numbers are calculated from 
> the page numbers). Now I want to create a cross reference that returns 
> the column number of the target. How can I achieve this?
>
> Of course, I can get the page number with \pagereference (for the 
> target) and \at (for the reference), but for calculating the column 
> number (according to what I did in the header), I would also need to 
> know whether the target is in the left or in the right column, and I 
> can't see how I can get this information.
>
> For an example, see the question posted by me at stackexchange:
> https://tex.stackexchange.com/questions/502944/context-cross-references-to-column-numbers 
>
>
> Besides, I am wondering, regarding the generally very regular and 
> consistent naming of commands in ConTeXt, why this is not so in the 
> case of references. For example, to refer to a page, I need 
> \pagereference (for the target) and \at (for the reference); to refer 
> to a line, I need \someline (for the target) and \inline (for the 
> reference), but only if I want it to automatically add the word "line" 
> or something else before the number, otherwise I have to use 
> \inlinerange. It took me some time to find that out. Wouldn't it be 
> easier to have just one command for the target and another one for the 
> reference, and everything else, as counters and headers to be 
> returned, text to be added etc. to be configured by options?
>
> Best regards,
> Oliver.
>
>
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Cross references to column numbers
  2019-09-02 16:46 ` Oliver von Criegern
@ 2019-09-09 20:05   ` Henri Menke
  2019-09-10 11:16     ` Hans Hagen
  0 siblings, 1 reply; 12+ messages in thread
From: Henri Menke @ 2019-09-09 20:05 UTC (permalink / raw)
  To: ntg-context

Bump

On 9/3/19 4:46 AM, Oliver von Criegern wrote:
> Dear list members,
> 
> is there any way to get a cross reference to a column in a two column layout?
> 
> At least, I would need to get some value that tells me whether the target is in the left or in the right column. How to achieve this?
> 
> This is the more simplified version of the my previous question cited below.
> 
> Best regards,
> Oliver.
> 
> 
> Am 12.08.19 um 15:26 schrieb Oliver von Criegern:
>> Dear list members,
>>
>> how can I create cross references to column numbers?
>>
>> I have a two column layout with column numbers in the header instead of page numbers (actually, these column numbers are calculated from the page numbers). Now I want to create a cross reference that returns the column number of the target. How can I achieve this?
>>
>> Of course, I can get the page number with \pagereference (for the target) and \at (for the reference), but for calculating the column number (according to what I did in the header), I would also need to know whether the target is in the left or in the right column, and I can't see how I can get this information.
>>
>> For an example, see the question posted by me at stackexchange:
>> https://tex.stackexchange.com/questions/502944/context-cross-references-to-column-numbers
>>
>> Besides, I am wondering, regarding the generally very regular and consistent naming of commands in ConTeXt, why this is not so in the case of references. For example, to refer to a page, I need \pagereference (for the target) and \at (for the reference); to refer to a line, I need \someline (for the target) and \inline (for the reference), but only if I want it to automatically add the word "line" or something else before the number, otherwise I have to use \inlinerange. It took me some time to find that out. Wouldn't it be easier to have just one command for the target and another one for the reference, and everything else, as counters and headers to be returned, text to be added etc. to be configured by options?
>>
>> Best regards,
>> Oliver.
>>
>>
> ___________________________________________________________________________________
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Cross references to column numbers
  2019-09-09 20:05   ` Henri Menke
@ 2019-09-10 11:16     ` Hans Hagen
  2019-09-10 16:52       ` Oliver von Criegern
                         ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Hans Hagen @ 2019-09-10 11:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 9/9/2019 10:05 PM, Henri Menke wrote:
> Bump
> 
> On 9/3/19 4:46 AM, Oliver von Criegern wrote:
>> Dear list members,
>>
>> is there any way to get a cross reference to a column in a two column layout?

yes and no:

no : there is not something buil tin
yes: one can write some hack in a few lines

but instead of posting such a hack (which then will a live of its own) 
i'll add a feature:

\pagereference[column:#1]

\doifelsereferencefound{column:#1}{\number\referencecolumnnumber}{}

in the next beta,

Hans

>> At least, I would need to get some value that tells me whether the target is in the left or in the right column. How to achieve this?
>>
>> This is the more simplified version of the my previous question cited below.
>>
>> Best regards,
>> Oliver.
>>
>>
>> Am 12.08.19 um 15:26 schrieb Oliver von Criegern:
>>> Dear list members,
>>>
>>> how can I create cross references to column numbers?
>>>
>>> I have a two column layout with column numbers in the header instead of page numbers (actually, these column numbers are calculated from the page numbers). Now I want to create a cross reference that returns the column number of the target. How can I achieve this?
>>>
>>> Of course, I can get the page number with \pagereference (for the target) and \at (for the reference), but for calculating the column number (according to what I did in the header), I would also need to know whether the target is in the left or in the right column, and I can't see how I can get this information.
>>>
>>> For an example, see the question posted by me at stackexchange:
>>> https://tex.stackexchange.com/questions/502944/context-cross-references-to-column-numbers
>>>
>>> Besides, I am wondering, regarding the generally very regular and consistent naming of commands in ConTeXt, why this is not so in the case of references. For example, to refer to a page, I need \pagereference (for the target) and \at (for the reference); to refer to a line, I need \someline (for the target) and \inline (for the reference), but only if I want it to automatically add the word "line" or something else before the number, otherwise I have to use \inlinerange. It took me some time to find that out. Wouldn't it be easier to have just one command for the target and another one for the reference, and everything else, as counters and headers to be returned, text to be added etc. to be configured by options?
Because all these \in \at \about ... give back different things (a 
title, a number, a range, a ...) and packaging all that in one macro 
doens't make it cleaner so soon users will then wrap complex calls in a 
macro of their own (which then can clash with some existing name).

Also, the ref mechanism evolved over decades and we're not going to drop 
compatibility.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Cross references to column numbers
  2019-09-10 11:16     ` Hans Hagen
@ 2019-09-10 16:52       ` Oliver von Criegern
  2019-09-10 20:05       ` Henning Hraban Ramm
  2019-11-12 12:02       ` Oliver von Criegern
  2 siblings, 0 replies; 12+ messages in thread
From: Oliver von Criegern @ 2019-09-10 16:52 UTC (permalink / raw)
  To: ntg-context


Am 10.09.19 um 13:16 schrieb Hans Hagen:
> On 9/9/2019 10:05 PM, Henri Menke wrote:
>> Bump
>>
>> On 9/3/19 4:46 AM, Oliver von Criegern wrote:
>>> Dear list members,
>>>
>>> is there any way to get a cross reference to a column in a two 
>>> column layout?
>
> yes and no:
>
> no : there is not something buil tin
> yes: one can write some hack in a few lines
>
> but instead of posting such a hack (which then will a live of its own) 
> i'll add a feature:
>
> \pagereference[column:#1]
>
> \doifelsereferencefound{column:#1}{\number\referencecolumnnumber}{}
>
> in the next beta,
>
> Hans


This would be great, thanks!

Best regards,
Oliver


>
>>> At least, I would need to get some value that tells me whether the 
>>> target is in the left or in the right column. How to achieve this?
>>>
>>> This is the more simplified version of the my previous question 
>>> cited below.
>>>
>>> Best regards,
>>> Oliver.
>>>
>>>
>>> Am 12.08.19 um 15:26 schrieb Oliver von Criegern:
>>>> Dear list members,
>>>>
>>>> how can I create cross references to column numbers?
>>>>
>>>> I have a two column layout with column numbers in the header 
>>>> instead of page numbers (actually, these column numbers are 
>>>> calculated from the page numbers). Now I want to create a cross 
>>>> reference that returns the column number of the target. How can I 
>>>> achieve this?
>>>>
>>>> Of course, I can get the page number with \pagereference (for the 
>>>> target) and \at (for the reference), but for calculating the column 
>>>> number (according to what I did in the header), I would also need 
>>>> to know whether the target is in the left or in the right column, 
>>>> and I can't see how I can get this information.
>>>>
>>>> For an example, see the question posted by me at stackexchange:
>>>> https://tex.stackexchange.com/questions/502944/context-cross-references-to-column-numbers 
>>>>
>>>>
>>>> Besides, I am wondering, regarding the generally very regular and 
>>>> consistent naming of commands in ConTeXt, why this is not so in the 
>>>> case of references. For example, to refer to a page, I need 
>>>> \pagereference (for the target) and \at (for the reference); to 
>>>> refer to a line, I need \someline (for the target) and \inline (for 
>>>> the reference), but only if I want it to automatically add the word 
>>>> "line" or something else before the number, otherwise I have to use 
>>>> \inlinerange. It took me some time to find that out. Wouldn't it be 
>>>> easier to have just one command for the target and another one for 
>>>> the reference, and everything else, as counters and headers to be 
>>>> returned, text to be added etc. to be configured by options?
> Because all these \in \at \about ... give back different things (a 
> title, a number, a range, a ...) and packaging all that in one macro 
> doens't make it cleaner so soon users will then wrap complex calls in 
> a macro of their own (which then can clash with some existing name).
>
> Also, the ref mechanism evolved over decades and we're not going to 
> drop compatibility.
>
> Hans
>
> -----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA ADE
>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
> ___________________________________________________________________________________ 
>
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________ 
>

-- 
Dr. Oliver von Criegern
Referat für IT und Digital Humanities
Bayerische Akademie der Wissenschaften
Alfons-Goppel-Str. 11
80539 München
Tel.: 089-23031-1310

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Cross references to column numbers
  2019-09-10 11:16     ` Hans Hagen
  2019-09-10 16:52       ` Oliver von Criegern
@ 2019-09-10 20:05       ` Henning Hraban Ramm
  2019-11-12 12:02       ` Oliver von Criegern
  2 siblings, 0 replies; 12+ messages in thread
From: Henning Hraban Ramm @ 2019-09-10 20:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 2019-09-10 um 13:16 schrieb Hans Hagen <j.hagen@xs4all.nl>:
> 
> On 9/9/2019 10:05 PM, Henri Menke wrote:
>> Bump
>> On 9/3/19 4:46 AM, Oliver von Criegern wrote:
>>> Dear list members,
>>> 
>>> is there any way to get a cross reference to a column in a two column layout?
> 
> yes and no:
> 
> no : there is not something buil tin
> yes: one can write some hack in a few lines
> 
> but instead of posting such a hack (which then will a live of its own) i'll add a feature:
> 
> \pagereference[column:#1]
> 
> \doifelsereferencefound{column:#1}{\number\referencecolumnnumber}{}
> 
> in the next beta,

Dear Oliver,
please don’t forget to document this on the appropriate wiki pages!


Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Cross references to column numbers
  2019-09-10 11:16     ` Hans Hagen
  2019-09-10 16:52       ` Oliver von Criegern
  2019-09-10 20:05       ` Henning Hraban Ramm
@ 2019-11-12 12:02       ` Oliver von Criegern
  2019-11-15 14:44         ` Oliver von Criegern
  2 siblings, 1 reply; 12+ messages in thread
From: Oliver von Criegern @ 2019-11-12 12:02 UTC (permalink / raw)
  To: ntg-context, Hans Hagen

Am 10.09.19 um 13:16 schrieb Hans Hagen:
> On 9/9/2019 10:05 PM, Henri Menke wrote:
>> Bump
>>
>> On 9/3/19 4:46 AM, Oliver von Criegern wrote:
>>> Dear list members,
>>>
>>> is there any way to get a cross reference to a column in a two 
>>> column layout?
>
> yes and no:
>
> no : there is not something buil tin
> yes: one can write some hack in a few lines
>
> but instead of posting such a hack (which then will a live of its own) 
> i'll add a feature:
>
> \pagereference[column:#1]
>
> \doifelsereferencefound{column:#1}{\number\referencecolumnnumber}{}
>
> in the next beta,
>
> Hans

Thanks for implementing this, but I am afraid it does not work properly, 
at least not if there are several targets following one after another.

Consider this example:


\setupcolumns[
     n=2,
]
\setuplinenumbering[
     step=5,
     method=page,
]

\def\Lab#1{%
\pagereference[#1]%
\pagereference[column:#1]%
\someline[#1]%
}

\def\Ref#1{
page \at[#1],
column \doifelsereferencefound{column:#1}{\number\referencecolumnnumber}{},
line \inlinerange[#1].
}

\starttext
\startcolumns
\startlinenumbering

REFERENCES:\par
A: \Ref{A}\par
B: \Ref{B}\par
C: \Ref{C}\par
D: \Ref{D}\par
E: \Ref{E}\par
F: \Ref{F}\par
\input lorem
TARGETS:
\Lab{A} A,
\Lab{B} B,
\Lab{C} C.
\input lorem
TARGETS:
\Lab{D} D,
\Lab{E} E,
\Lab{F} F.
\input lorem

\stoplinenumbering
\stopcolumns
\stoptext

As you will see, targets A, B and C are all in the first column, and 
targets D, E and F are all in the second column. But the references read 
as follows:

A: page 1, column 1, line 29.
B: page 1, column 1, line 29.
C: page 1, column 2, line 29.
D: page 1, column 2, line 14.
E: page 1, column 3, line 14.
F: page 1, column 3, line 14.


Best regards,
Oliver


>
>>> At least, I would need to get some value that tells me whether the 
>>> target is in the left or in the right column. How to achieve this?
>>>
>>> This is the more simplified version of the my previous question 
>>> cited below.
>>>
>>> Best regards,
>>> Oliver.
>>>
>>>
>>> Am 12.08.19 um 15:26 schrieb Oliver von Criegern:
>>>> Dear list members,
>>>>
>>>> how can I create cross references to column numbers?
>>>>
>>>> I have a two column layout with column numbers in the header 
>>>> instead of page numbers (actually, these column numbers are 
>>>> calculated from the page numbers). Now I want to create a cross 
>>>> reference that returns the column number of the target. How can I 
>>>> achieve this?
>>>>
>>>> Of course, I can get the page number with \pagereference (for the 
>>>> target) and \at (for the reference), but for calculating the column 
>>>> number (according to what I did in the header), I would also need 
>>>> to know whether the target is in the left or in the right column, 
>>>> and I can't see how I can get this information.
>>>>
>>>> For an example, see the question posted by me at stackexchange:
>>>> https://tex.stackexchange.com/questions/502944/context-cross-references-to-column-numbers 
>>>>
>>>>
>>>> Besides, I am wondering, regarding the generally very regular and 
>>>> consistent naming of commands in ConTeXt, why this is not so in the 
>>>> case of references. For example, to refer to a page, I need 
>>>> \pagereference (for the target) and \at (for the reference); to 
>>>> refer to a line, I need \someline (for the target) and \inline (for 
>>>> the reference), but only if I want it to automatically add the word 
>>>> "line" or something else before the number, otherwise I have to use 
>>>> \inlinerange. It took me some time to find that out. Wouldn't it be 
>>>> easier to have just one command for the target and another one for 
>>>> the reference, and everything else, as counters and headers to be 
>>>> returned, text to be added etc. to be configured by options?
> Because all these \in \at \about ... give back different things (a 
> title, a number, a range, a ...) and packaging all that in one macro 
> doens't make it cleaner so soon users will then wrap complex calls in 
> a macro of their own (which then can clash with some existing name).
>
> Also, the ref mechanism evolved over decades and we're not going to 
> drop compatibility.
>
> Hans
>
> -----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA ADE
>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
> ___________________________________________________________________________________ 
>
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________ 
>

-- 
Dr. Oliver von Criegern
Referat für IT und Digital Humanities
Bayerische Akademie der Wissenschaften
Alfons-Goppel-Str. 11
80539 München
Tel.: 089-23031-1310

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Cross references to column numbers
  2019-11-12 12:02       ` Oliver von Criegern
@ 2019-11-15 14:44         ` Oliver von Criegern
  2019-11-15 15:31           ` Taco Hoekwater
  2019-11-15 19:22           ` Pablo Rodriguez
  0 siblings, 2 replies; 12+ messages in thread
From: Oliver von Criegern @ 2019-11-15 14:44 UTC (permalink / raw)
  To: ntg-context, Hans Hagen

Could someone please take a look at this?

Am 12.11.19 um 13:02 schrieb Oliver von Criegern:
> Am 10.09.19 um 13:16 schrieb Hans Hagen:
>> On 9/9/2019 10:05 PM, Henri Menke wrote:
>>> Bump
>>>
>>> On 9/3/19 4:46 AM, Oliver von Criegern wrote:
>>>> Dear list members,
>>>>
>>>> is there any way to get a cross reference to a column in a two 
>>>> column layout?
>>
>> yes and no:
>>
>> no : there is not something buil tin
>> yes: one can write some hack in a few lines
>>
>> but instead of posting such a hack (which then will a live of its 
>> own) i'll add a feature:
>>
>> \pagereference[column:#1]
>>
>> \doifelsereferencefound{column:#1}{\number\referencecolumnnumber}{}
>>
>> in the next beta,
>>
>> Hans
>
> Thanks for implementing this, but I am afraid it does not work 
> properly, at least not if there are several targets following one 
> after another.
>
> Consider this example:
>
>
> \setupcolumns[
>     n=2,
> ]
> \setuplinenumbering[
>     step=5,
>     method=page,
> ]
>
> \def\Lab#1{%
> \pagereference[#1]%
> \pagereference[column:#1]%
> \someline[#1]%
> }
>
> \def\Ref#1{
> page \at[#1],
> column 
> \doifelsereferencefound{column:#1}{\number\referencecolumnnumber}{},
> line \inlinerange[#1].
> }
>
> \starttext
> \startcolumns
> \startlinenumbering
>
> REFERENCES:\par
> A: \Ref{A}\par
> B: \Ref{B}\par
> C: \Ref{C}\par
> D: \Ref{D}\par
> E: \Ref{E}\par
> F: \Ref{F}\par
> \input lorem
> TARGETS:
> \Lab{A} A,
> \Lab{B} B,
> \Lab{C} C.
> \input lorem
> TARGETS:
> \Lab{D} D,
> \Lab{E} E,
> \Lab{F} F.
> \input lorem
>
> \stoplinenumbering
> \stopcolumns
> \stoptext
>
> As you will see, targets A, B and C are all in the first column, and 
> targets D, E and F are all in the second column. But the references 
> read as follows:
>
> A: page 1, column 1, line 29.
> B: page 1, column 1, line 29.
> C: page 1, column 2, line 29.
> D: page 1, column 2, line 14.
> E: page 1, column 3, line 14.
> F: page 1, column 3, line 14.
>
>
> Best regards,
> Oliver
>
>
>>
>>>> At least, I would need to get some value that tells me whether the 
>>>> target is in the left or in the right column. How to achieve this?
>>>>
>>>> This is the more simplified version of the my previous question 
>>>> cited below.
>>>>
>>>> Best regards,
>>>> Oliver.
>>>>
>>>>
>>>> Am 12.08.19 um 15:26 schrieb Oliver von Criegern:
>>>>> Dear list members,
>>>>>
>>>>> how can I create cross references to column numbers?
>>>>>
>>>>> I have a two column layout with column numbers in the header 
>>>>> instead of page numbers (actually, these column numbers are 
>>>>> calculated from the page numbers). Now I want to create a cross 
>>>>> reference that returns the column number of the target. How can I 
>>>>> achieve this?
>>>>>
>>>>> Of course, I can get the page number with \pagereference (for the 
>>>>> target) and \at (for the reference), but for calculating the 
>>>>> column number (according to what I did in the header), I would 
>>>>> also need to know whether the target is in the left or in the 
>>>>> right column, and I can't see how I can get this information.
>>>>>
>>>>> For an example, see the question posted by me at stackexchange:
>>>>> https://tex.stackexchange.com/questions/502944/context-cross-references-to-column-numbers 
>>>>>
>>>>>
>>>>> Besides, I am wondering, regarding the generally very regular and 
>>>>> consistent naming of commands in ConTeXt, why this is not so in 
>>>>> the case of references. For example, to refer to a page, I need 
>>>>> \pagereference (for the target) and \at (for the reference); to 
>>>>> refer to a line, I need \someline (for the target) and \inline 
>>>>> (for the reference), but only if I want it to automatically add 
>>>>> the word "line" or something else before the number, otherwise I 
>>>>> have to use \inlinerange. It took me some time to find that out. 
>>>>> Wouldn't it be easier to have just one command for the target and 
>>>>> another one for the reference, and everything else, as counters 
>>>>> and headers to be returned, text to be added etc. to be configured 
>>>>> by options?
>> Because all these \in \at \about ... give back different things (a 
>> title, a number, a range, a ...) and packaging all that in one macro 
>> doens't make it cleaner so soon users will then wrap complex calls in 
>> a macro of their own (which then can clash with some existing name).
>>
>> Also, the ref mechanism evolved over decades and we're not going to 
>> drop compatibility.
>>
>> Hans
>>
>> -----------------------------------------------------------------
>>                                           Hans Hagen | PRAGMA ADE
>>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>>        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
>> -----------------------------------------------------------------
>> ___________________________________________________________________________________ 
>>
>> 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://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki     : http://contextgarden.net
>> ___________________________________________________________________________________ 
>>
>
-- 
Dr. Oliver von Criegern
Referat für IT und Digital Humanities
Bayerische Akademie der Wissenschaften
Alfons-Goppel-Str. 11
80539 München
Tel.: 089-23031-1310

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Cross references to column numbers
  2019-11-15 14:44         ` Oliver von Criegern
@ 2019-11-15 15:31           ` Taco Hoekwater
  2019-11-15 15:36             ` Taco Hoekwater
  2019-11-15 19:22           ` Pablo Rodriguez
  1 sibling, 1 reply; 12+ messages in thread
From: Taco Hoekwater @ 2019-11-15 15:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

> On 15 Nov 2019, at 15:44, Oliver von Criegern <oliver.v.criegern@badw-muenchen.de> wrote:
> 
> Could someone please take a look at this?

Well, I can tell you what is wrong …

The definition of \referencecolumnnumber is like this:

\def\referencecolumnnumber
  {\numexpr \dimexpr \clf_referenceposx -\cutspace \relax /
            \dimexpr \makeupwidth /\nofcolumns \relax 
   +\plusone \relax }

But that outer \numexpr rounds instead of truncates. so anything that
is past halfway of the column is rounded too far up. This fixes it
(but not very elegantly)

\unprotect
\def\referencecolumnnumber
  {\numexpr \dimexpr \clf_referenceposx -\cutspace - \makeupwidth /(2*\nofcolumns) \relax /
            \dimexpr \makeupwidth /\nofcolumns \relax 
   +\plusone \relax }
\protect
 

Best wishes,
Taco

> 
> Am 12.11.19 um 13:02 schrieb Oliver von Criegern:
>> Am 10.09.19 um 13:16 schrieb Hans Hagen:
>>> On 9/9/2019 10:05 PM, Henri Menke wrote:
>>>> Bump
>>>> 
>>>> On 9/3/19 4:46 AM, Oliver von Criegern wrote:
>>>>> Dear list members,
>>>>> 
>>>>> is there any way to get a cross reference to a column in a two column layout?
>>> 
>>> yes and no:
>>> 
>>> no : there is not something buil tin
>>> yes: one can write some hack in a few lines
>>> 
>>> but instead of posting such a hack (which then will a live of its own) i'll add a feature:
>>> 
>>> \pagereference[column:#1]
>>> 
>>> \doifelsereferencefound{column:#1}{\number\referencecolumnnumber}{}
>>> 
>>> in the next beta,
>>> 
>>> Hans
>> 
>> Thanks for implementing this, but I am afraid it does not work properly, at least not if there are several targets following one after another.
>> 
>> Consider this example:
>> 
>> 
>> \setupcolumns[
>>     n=2,
>> ]
>> \setuplinenumbering[
>>     step=5,
>>     method=page,
>> ]
>> 
>> \def\Lab#1{%
>> \pagereference[#1]%
>> \pagereference[column:#1]%
>> \someline[#1]%
>> }
>> 
>> \def\Ref#1{
>> page \at[#1],
>> column \doifelsereferencefound{column:#1}{\number\referencecolumnnumber}{},
>> line \inlinerange[#1].
>> }
>> 
>> \starttext
>> \startcolumns
>> \startlinenumbering
>> 
>> REFERENCES:\par
>> A: \Ref{A}\par
>> B: \Ref{B}\par
>> C: \Ref{C}\par
>> D: \Ref{D}\par
>> E: \Ref{E}\par
>> F: \Ref{F}\par
>> \input lorem
>> TARGETS:
>> \Lab{A} A,
>> \Lab{B} B,
>> \Lab{C} C.
>> \input lorem
>> TARGETS:
>> \Lab{D} D,
>> \Lab{E} E,
>> \Lab{F} F.
>> \input lorem
>> 
>> \stoplinenumbering
>> \stopcolumns
>> \stoptext
>> 
>> As you will see, targets A, B and C are all in the first column, and targets D, E and F are all in the second column. But the references read as follows:
>> 
>> A: page 1, column 1, line 29.
>> B: page 1, column 1, line 29.
>> C: page 1, column 2, line 29.
>> D: page 1, column 2, line 14.
>> E: page 1, column 3, line 14.
>> F: page 1, column 3, line 14.
>> 
>> 
>> Best regards,
>> Oliver
>> 
>> 
>>> 
>>>>> At least, I would need to get some value that tells me whether the target is in the left or in the right column. How to achieve this?
>>>>> 
>>>>> This is the more simplified version of the my previous question cited below.
>>>>> 
>>>>> Best regards,
>>>>> Oliver.
>>>>> 
>>>>> 
>>>>> Am 12.08.19 um 15:26 schrieb Oliver von Criegern:
>>>>>> Dear list members,
>>>>>> 
>>>>>> how can I create cross references to column numbers?
>>>>>> 
>>>>>> I have a two column layout with column numbers in the header instead of page numbers (actually, these column numbers are calculated from the page numbers). Now I want to create a cross reference that returns the column number of the target. How can I achieve this?
>>>>>> 
>>>>>> Of course, I can get the page number with \pagereference (for the target) and \at (for the reference), but for calculating the column number (according to what I did in the header), I would also need to know whether the target is in the left or in the right column, and I can't see how I can get this information.
>>>>>> 
>>>>>> For an example, see the question posted by me at stackexchange:
>>>>>> https://tex.stackexchange.com/questions/502944/context-cross-references-to-column-numbers 
>>>>>> 
>>>>>> Besides, I am wondering, regarding the generally very regular and consistent naming of commands in ConTeXt, why this is not so in the case of references. For example, to refer to a page, I need \pagereference (for the target) and \at (for the reference); to refer to a line, I need \someline (for the target) and \inline (for the reference), but only if I want it to automatically add the word "line" or something else before the number, otherwise I have to use \inlinerange. It took me some time to find that out. Wouldn't it be easier to have just one command for the target and another one for the reference, and everything else, as counters and headers to be returned, text to be added etc. to be configured by options?
>>> Because all these \in \at \about ... give back different things (a title, a number, a range, a ...) and packaging all that in one macro doens't make it cleaner so soon users will then wrap complex calls in a macro of their own (which then can clash with some existing name).
>>> 
>>> Also, the ref mechanism evolved over decades and we're not going to drop compatibility.
>>> 
>>> Hans
>>> 
>>> -----------------------------------------------------------------
>>>                                           Hans Hagen | PRAGMA ADE
>>>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>>>        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
>>> -----------------------------------------------------------------
>>> ___________________________________________________________________________________ 
>>> 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://context.aanhet.net
>>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>>> wiki     : http://contextgarden.net
>>> ___________________________________________________________________________________ 
>> 
> -- 
> Dr. Oliver von Criegern
> Referat für IT und Digital Humanities
> Bayerische Akademie der Wissenschaften
> Alfons-Goppel-Str. 11
> 80539 München
> Tel.: 089-23031-1310
> 
> ___________________________________________________________________________________
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

Taco Hoekwater
Elvenkind BV




___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Cross references to column numbers
  2019-11-15 15:31           ` Taco Hoekwater
@ 2019-11-15 15:36             ` Taco Hoekwater
  0 siblings, 0 replies; 12+ messages in thread
From: Taco Hoekwater @ 2019-11-15 15:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users



> On 15 Nov 2019, at 16:31, Taco Hoekwater <taco@elvenkind.com> wrote:
> 
> But that outer \numexpr rounds instead of truncates. so anything that
> is past halfway   of the column is rounded too far up. This fixes it
                 ^ horizontally

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Cross references to column numbers
  2019-11-15 14:44         ` Oliver von Criegern
  2019-11-15 15:31           ` Taco Hoekwater
@ 2019-11-15 19:22           ` Pablo Rodriguez
  2019-11-16  8:59             ` Hans Hagen
  1 sibling, 1 reply; 12+ messages in thread
From: Pablo Rodriguez @ 2019-11-15 19:22 UTC (permalink / raw)
  To: ntg-context

On 11/15/19 3:44 PM, Oliver von Criegern wrote:
> Could someone please take a look at this?
>
> Am 12.11.19 um 13:02 schrieb Oliver von Criegern:
>> [...]
>> As you will see, targets A, B and C are all in the first column, and
>> targets D, E and F are all in the second column. But the references
>> read as follows:

Hi Oliver,

with latest beta from 2019.11.14 17:07 (and even the previous one),
references read:

    A: page 1, column 1, line 29.
    B: page 1, column 1, line 29.
    C: page 1, column 1, line 29.
    D: page 1, column 2, line 14.
    E: page 1, column 2, line 14.
    F: page 1, column 2, line 14.

I think your issue has been fixed. Or what is wrong there?

Just in case it helps,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Cross references to column numbers
  2019-11-15 19:22           ` Pablo Rodriguez
@ 2019-11-16  8:59             ` Hans Hagen
  0 siblings, 0 replies; 12+ messages in thread
From: Hans Hagen @ 2019-11-16  8:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 11/15/2019 8:22 PM, Pablo Rodriguez wrote:
> On 11/15/19 3:44 PM, Oliver von Criegern wrote:
>> Could someone please take a look at this?
>>
>> Am 12.11.19 um 13:02 schrieb Oliver von Criegern:
>>> [...]
>>> As you will see, targets A, B and C are all in the first column, and
>>> targets D, E and F are all in the second column. But the references
>>> read as follows:
> 
> Hi Oliver,
> 
> with latest beta from 2019.11.14 17:07 (and even the previous one),
> references read:
> 
>      A: page 1, column 1, line 29.
>      B: page 1, column 1, line 29.
>      C: page 1, column 1, line 29.
>      D: page 1, column 2, line 14.
>      E: page 1, column 2, line 14.
>      F: page 1, column 2, line 14.
> 
> I think your issue has been fixed. Or what is wrong there?
different implementation

(taco's solution is for the older method, but that method is a bit 
sensitive for different r/l layouts)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2019-11-16  8:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-12 13:26 Cross references to column numbers Oliver von Criegern
2019-09-02 16:46 ` Oliver von Criegern
2019-09-09 20:05   ` Henri Menke
2019-09-10 11:16     ` Hans Hagen
2019-09-10 16:52       ` Oliver von Criegern
2019-09-10 20:05       ` Henning Hraban Ramm
2019-11-12 12:02       ` Oliver von Criegern
2019-11-15 14:44         ` Oliver von Criegern
2019-11-15 15:31           ` Taco Hoekwater
2019-11-15 15:36             ` Taco Hoekwater
2019-11-15 19:22           ` Pablo Rodriguez
2019-11-16  8:59             ` Hans Hagen

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