* conditional for undefined references
@ 2020-03-29 11:53 Pablo Rodriguez
2020-03-29 12:33 ` Wolfgang Schuster
0 siblings, 1 reply; 3+ messages in thread
From: Pablo Rodriguez @ 2020-03-29 11:53 UTC (permalink / raw)
To: mailing list for ConTeXt users
Dear list,
consider the following sample:
\setuppapersize[A8]
\starttext
\ConTeXt:
\in[seac]
Is it defined?:
\doifelse{\in[seac]}{??}{undefined}{defined}
\Lua:
\ctxlua{context([[{\in[seac]}]])}
Is it defined?:
\startlua
if [[{\in[seac]}]] == "??" then
context("undefined")
else
context("defined")
end
\stoplua
\stoptext
Is there a way to deal with undefined references?
I mean, I need a conditional to handle undefined references.
Why do I have undefined references in my documents? Well, I have almost
90 (Markdown) documents that I need to compile as single documents and
also as one document. When compiling as single documents, there are a
few references to other documents. This is the reason why they are
undefined.
Any chance to be able to catch a "??" output (or \dummyreference) from
"\in[reference]"?
Many thanks for your help,
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] 3+ messages in thread
* Re: conditional for undefined references
2020-03-29 11:53 conditional for undefined references Pablo Rodriguez
@ 2020-03-29 12:33 ` Wolfgang Schuster
2020-03-30 8:06 ` Pablo Rodriguez
0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2020-03-29 12:33 UTC (permalink / raw)
To: mailing list for ConTeXt users, Pablo Rodriguez
Pablo Rodriguez schrieb am 29.03.2020 um 13:53:
> Dear list,
>
> consider the following sample:
>
> \setuppapersize[A8]
> \starttext
> \ConTeXt:
>
> \in[seac]
>
> Is it defined?:
> \doifelse{\in[seac]}{??}{undefined}{defined}
>
> \Lua:
>
> \ctxlua{context([[{\in[seac]}]])}
>
> Is it defined?:
> \startlua
> if [[{\in[seac]}]] == "??" then
> context("undefined")
> else
> context("defined")
> end
> \stoplua
> \stoptext
>
>
> Is there a way to deal with undefined references?
>
> I mean, I need a conditional to handle undefined references.
>
> Why do I have undefined references in my documents? Well, I have almost
> 90 (Markdown) documents that I need to compile as single documents and
> also as one document. When compiling as single documents, there are a
> few references to other documents. This is the reason why they are
> undefined.
>
> Any chance to be able to catch a "??" output (or \dummyreference) from
> "\in[reference]"?
>
> Many thanks for your help,
ConTeXt gives you a message about missing references in the log-file but
there is no simple way to show the in the PDF which is a step backwards
because in MkII it was able to get a small message in the margins about
unknown references.
What you can do is to use the \doifelsereferencefound command to check
if the requested reference exists before you get the page number etc.
\starttext
Take a look at
\doifelsereferencefound{unknown:1}
{\at{page}[unknown:1]}
{\dummyreference\inright[style=\ttxx]{Missing reference}}.
This line ha a reference.\pagereference[unknown:2]
Take a look at
\doifelsereferencefound{unknown:2}
{\at{page}[unknown:2]}
{\dummyreference\inright[style=\ttxx]{Missing reference}}.
\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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-30 8:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-29 11:53 conditional for undefined references Pablo Rodriguez
2020-03-29 12:33 ` Wolfgang Schuster
2020-03-30 8:06 ` Pablo Rodriguez
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).