texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] New algorithm style - need help


From: Sam Liddicott
Subject: Re: [Texmacs-dev] New algorithm style - need help
Date: Sat, 09 Apr 2011 15:01:20 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17pre) Gecko/20110408 Lanikai/3.1.10pre

On 09/04/11 13:28, Jan Lellmann wrote:
Thanks a lot Sam, that is very helpful. I suspext there are some "document" tags generated that shouldn't, or they are not properly parsed at the time where <indent-yes> happens, so Texmacs thinks the paragraph has already started, and indent-yes has no effect.

The (define-group enumerate algorithmic) idea is good, in fact I just found that I can include this snippet using <extern>, which makes the environment almost natively editable, much as itemize or enumerate.

Please could you explain about <extern> to me? I wasn't able to get it to work.

I found working line enum to be a better way. While what are effectively large parameters are editable, in multi-line mode it is <document> and won't line wrap.

I also got rid of table cells for borders, I found it an advantage for me to let large code blocks break over a page. I used a cunning trick to detect the break and set the page header to match the code block header, so I repeated the header on the second page.


Using this idea, the indentation in the first line can be fixed. However, several other problems appear (see attachment). In particular Texmacs doesn't let me edit the indented blocks as multiline content anymore.

Yes. That's because it's a concat not a document


I think is boils down to these questions:

1) How does Texmacs decide whether some macro argument should be editable by the user as "document" or as "inline", i.e. how does it decide whether creating new lines _inside_ an argument using the "return" key should be allowed?

From my experience it is always allowed. And if you do it the argument is suddenly "document" which contains strings and concat's of strings. Otherwise the argument was a string or a concat of strings. And once it becomes a document argument you can't change it back.

I had to have a special case in my macro to detect if it was a document or a concat.
I had:

<assign|itemly|<macro|x|<item><assign|the-label|<value|the-chunk-label>
<localize|line> <item-nr>><with|nf-len|0|<arg|x>>>>


<if|<equal|<get-label|<arg|x>>|document>|<map-args|itemly|document|x>|<arg|x>>


In any case you probably want to set the-label in your macro and possibly override <item> so that you can set the-label for each item, so that you can use <label> in your algorithm to create references with meaningful descriptions.



2) I found that quite often, the "Edit source tree" view inserts "document" tags around some argument, which screws up the rendering. They cannot subsequently be changed to "inline" mode and I did not find a way to remove them (even if they only a single argument). I had to edit the .tm in a text editor. What is the proper way to do this?

I can't do it except with "undo".

I like the fact that a document becomes an inline block but I wish there were also a way to enable line-wrap... but that means it being a concat not a document.

The only macro I know that helps with concat and document is "surround". It's been helpful to me but I don't have a reliable mental model of how it works.

For your interest I attach fangle.ts and code-new.tm (an example) which use the new method, based on <extern|(lambda() (define-group enumerate-tag nf-chunk))> (except it doesn't work for me, I have to execute it as a scheme command manually each time I start texmacs).

I also attach newfangle.ts and code.tm which work more the way you have been working (see nf-chunk at the bottom of newfangle.ts)

(Ironically newfangle.ts is the OLD way and fangle.ts is the NEW way).

The comment at the start of code.tm about a "code fragment" and not having pressed enter is what you were talking about. In my case it lets me press enter and turns the parameter into a document. Note that I don't use xmacros for this. Many of the macros in newfangle.ts are not used but are left over from me trying ideas to parse the tree argument - which can turn out to be quite slow which was part of my reason for moving over to enumerate type stuff - and it's nice to have the line-wrapping work.

Sam


Jan


_______________________________________________
Texmacs-dev mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/texmacs-dev


--
[FSF Associate Member #2325] <http://www.fsf.org/register_form?referrer=2325>

<http://www.openrightsgroup.org/>

Attachment: code.tm
Description: Text Data

Attachment: newfangle.ts
Description: application/linguist

Attachment: code-new.tm
Description: Text Data

Attachment: fangle.ts
Description: application/linguist

Attachment: code-new.pdf
Description: Adobe PDF document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]