Re: [NTG-context] Subject: Leading spaces verbatim

2023-01-28 Thread Hans Hagen via ntg-context

On 1/28/2023 9:26 PM, Kalouguine Andre via ntg-context wrote:

On 28.01.2023 17:37, Pablo Rodriguez via ntg-context wrote:


Using Fedora 37 (and having just installed Okular), I see that
annotations are tricky to open in Okular.

First you have to select the Annotations tab on the left pane, go to the
annotation and then right-click on it to open (the pop-up note).

Evince has a more effective approach: double-clicking on the icon opens
the note (afaIk, this is similar to Acrobat).

Right you are, it works with your method, thanks!
I think the students have Evince so perhaps it's the best solution in 
the absence
there are some provisions for spaces in text but for verbatim it is a 
bit more tricky


\setuptyping[space=on]

you now see visual spaces show up that can be copied

now, say that we add real spaces, which you can do after and this (in 
cont-new.mkxl):


\unprotect
\setvalue{\??typingspace\v!character}{\chardef\obeyedspace32 }
\protect

and then:

\setuptyping[space=character]

in sumatra pdf:

default   : spaces are copied as spaces (so three become three
on: visual spaces for every one
character : funny newlines when more than two spaces

Cheats that add some kerning before and after confuse viewers even more.

so: this is all very viewer dependent! (The suggested comment method is 
more reliable.)


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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] notes by paragraph

2023-01-28 Thread jbf via ntg-context

That solves the problem. Thank you.

Julian

On 28/1/23 23:22, Pablo Rodriguez via ntg-context wrote:

\setupnote[footnote][location=none] might help.

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Subject: Leading spaces verbatim

2023-01-28 Thread Kalouguine Andre via ntg-context
On 28.01.2023 17:37, Pablo Rodriguez via ntg-context wrote:

> Using Fedora 37 (and having just installed Okular), I see that
> annotations are tricky to open in Okular.
> 
> First you have to select the Annotations tab on the left pane, go to the
> annotation and then right-click on it to open (the pop-up note).
> 
> Evince has a more effective approach: double-clicking on the icon opens
> the note (afaIk, this is similar to Acrobat).

Right you are, it works with your method, thanks! 
I think the students have Evince so perhaps it's the best solution in
the absence 
of copiable spaces in verbatim mode. 
Thanks again! 
Best regards, 
Andre___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Subject: Leading spaces verbatim

2023-01-28 Thread Pablo Rodriguez via ntg-context
On 1/28/23 14:31, Kalouguine Andre via ntg-context wrote:
> Hi Pablo,

Hi André,

> [...]  
> That's actually something I had never thought of, using PDF comments,
> thanks!.

When I faced a similar task, I thought it could be the way of solving
the issue (how to copy and paste ConTeXt code and console commands).

> It's a really nice approach, though weirdly it doesn't work on
> Okular (Linux+KDE) for me, even though attachments worked fine. I'll
> try and see why that is.
Using Fedora 37 (and having just installed Okular), I see that
annotations are tricky to open in Okular.

First you have to select the Annotations tab on the left pane, go to the
annotation and then right-click on it to open (the pop-up note).

Evince has a more effective approach: double-clicking on the icon opens
the note (afaIk, this is similar to Acrobat).

I hope this helps,

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Subject: Leading spaces verbatim

2023-01-28 Thread Kalouguine Andre via ntg-context
Hi Pablo,

> \showframe
> \setupinteraction[state=start]
> \starttext
> \startbuffer[abc]
> def foo(x):
> if x == 0:
> bar()
> else:
> baz(x)
> foo(x - 1)
> \stopbuffer
> \comment[location=leftmargin,
> space=yes,
> buffer=abc,
> title={Python code}]
> {}\typebuffer[abc]
> \stoptext
> 
> This might solve what you need. At least, this is the approach that I
> use to provide text that can be directly copied.
> 
> I'm on Linux and last time I tested on Windows there were extra lines in
> the comments.

That's actually something I had never thought of, using PDF comments,
thanks!. 
It's a really nice approach, though weirdly it doesn't work on Okular
(Linux+KDE) 
for me, even though attachments worked fine. I'll try and see why that
is. 

What I had in mind was rather the following: 

\starttext 
\starttyping[space=on] 
def foo(x):
y = bar(x) 
if y: 
return x 
return y 
foo(1) 
\stoptyping 
\stoptext

but with ordinary char32 spaces rather than \textcontrolspace
characters. 

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] footnotes by paragraph?

2023-01-28 Thread Bruce Horrocks via ntg-context
On 28 Jan 2023, at 02:14, jbf via ntg-context  wrote:
> 
> Here's a tricky one (for me) that I haven't been able to work out. I am 
> dealing with a set of constitutions that I am organizing with a paragraph 
> definition 
> \defineparagraphs[Two][n=2]
> \setupparagraphs[Two][1][width=.2\textwidth,style=\bfx,after={\blank},align=flushleft]
> \setupparagraphs[Two][2][width=.77\textwidth,style=normal,after={\blank}]
> But I need to get the footnotes (which all apply to [2] in each article of 
> the constitutions) to come beneath my defined 'Two'. I do not want them to 
> come at the bottom of the page.
> I thought I might be able to do it by placing \start...stopTwo within a 
> \start...stopsection and defining \setupnotation[way=bysection] but that is 
> not working.
> Any thought on how I could approach this?
> Julian 

Does this help?

\defineparagraphs[Two][n=2]
\setupparagraphs[Two][1][width=.2\textwidth,style=\bfx,after={\blank},align=flushleft]
\setupparagraphs[Two][2][width=.77\textwidth,style=normal,after={\blank}]

\starttext
\startTwo
The role of the Committee
\Two
The role of the Committee\endnote{See a dictionary if you want to know what a 
committee is!} is very important.
Some more text.
\stopTwo
\startTwo
The Chairman
\Two
The role of the Chairman...
\stopTwo
\startTwo
~
\Two
\placenotes[endnote]

\stopTwo
\input knuth
\stoptext


—
Bruce Horrocks
Hampshire, UK

—
Bruce Horrocks
Hampshire, UK

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Subject: Leading spaces verbatim

2023-01-28 Thread Pablo Rodriguez via ntg-context
On 1/28/23 03:01, Kalouguine Andre via ntg-context wrote:
> Good day to everyone,
> 
> I'm trying to make a verbatim block of text with copiable leading spaces
> so that students can just copy my Python code snippets into their IDE.

Hi André,

I wonder whether I’m getting your point with the following sample:

  \showframe
  \setupinteraction[state=start]
  \starttext
  \startbuffer[abc]
  def foo(x):
  if x == 0:
  bar()
  else:
  baz(x)
  foo(x - 1)
  \stopbuffer
  \comment[location=leftmargin,
space=yes,
buffer=abc,
title={Python code}]
{}\typebuffer[abc]
  \stoptext

This might solve what you need. At least, this is the approach that I
use to provide text that can be directly copied.

I’m on Linux and last time I tested on Windows there were extra lines in
the comments.

Just in case it might help,

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] notes by paragraph

2023-01-28 Thread Pablo Rodriguez via ntg-context
On 1/28/23 03:58, jbf via ntg-context wrote:
> Re my earlier question on footnotes by defined paragraph:
> 
> \start...stoplocalfootnotes and \placelocalfootnotes largely solves the
> issue (had forgotten that option), but I am still getting the footnotes
> repeated at the bottom of the page. I am obviously missing a setting.
> There are parts of this text that do require the usual footnotes at the
> bottom, so I would not want to turn off this option permanently. I have
> tried \setupnotation[footnote][display=no] but that is not working.

Hi Julian,

\setupnote[footnote][location=none] might help.

Since you don’t provide a minimal sample to play with, I cannot tell
whether this works or not.

Just in case it helps,

Pablo

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___