Re: [NTG-context] How to write readable source files?
On 2021-04-24, juh wrote: > Am Sat, Apr 24, 2021 at 01:55:28PM +0200 schrieb Henning Hraban Ramm: >> I guess many of us adhere to Hans’ style, as shown in the sources. >> >> i.e. e.g. >> \setupsomething >> [name] >> [key=value, >>otherkey=value] >> >> while I prefer: >> >> \setupsomething[name][ >> key=value, >> otherkey=value, >> ] > > I, too, stick to these styles more or less. > > But after many iterations my code gets scrambled so that I would be happy to > reformat it via some tool. The usual functions in Vim and Emacs never results > in > a style like this. I maintain the ConTeXt plugin for Vim. Currently, there are no indentation rules (except for embedded MetaPost code), and that is intentional: as the examples above show, there is no commonly accepted indentation style, so forcing one on the user is not a good idea. That said, if you have a list of desiderata, I may consider adding an option to enable them. You may open an issue here for further discussion: https://github.com/lifepillar/vim-context-metapost If you need to reflow paragraphs, the plugin provides the tp text object. So, for instance, you may type gqtp to reformat the current paragraph (with hard breaks) using the current textwidth. Nicola ___ 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 ___
Re: [NTG-context] How to write readable source files?
Am Sat, Apr 24, 2021 at 01:55:28PM +0200 schrieb Henning Hraban Ramm: > I guess many of us adhere to Hans’ style, as shown in the sources. > > i.e. e.g. > \setupsomething > [name] > [key=value, >otherkey=value] > > while I prefer: > > \setupsomething[name][ > key=value, > otherkey=value, > ] I, too, stick to these styles more or less. But after many iterations my code gets scrambled so that I would be happy to reformat it via some tool. The usual functions in Vim and Emacs never results in a style like this. Ciao! Jan Ulrich Hasecke -- Autoren-Homepage: . http://literatur.hasecke.com Satiren & Essays: . http://www.sudelbuch.de Privater Blog: http://www.hasecke.eu Netzliteratur-Projekt: http://www.generationenprojekt.de signature.asc Description: PGP signature ___ 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 ___
Re: [NTG-context] Fwd: Corrupt PDF files with LMTX?
On 4/24/2021 3:05 PM, Jairo A. del Rio wrote: gives Error: stream Length incorrect. Output may be incorrect. Error: stream Length incorrect. Output may be incorrect. I'll check it - 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 ___
Re: [NTG-context] How to write readable source files?
On 4/24/2021 11:45 AM, Jan U. Hasecke wrote: Hi all, how do you format your ConTeXt source files? I recently discovered prettier which reformats source files for different markup and programming languages such as html, markdown, json etc. There are some other tools around but I don't find anything for ConTeXt. Do you know of any prettifying tool? Is there a best practice for ConTeXt source files, at all? most of the documentation files are ok actually i often spend quite some time on formatting because inconstent formatting for sure leads to errors .. .keep in mind that in tex spaces and empty lines often matter if you use the scite lexer (in verbatim) you also get an idea how I see the source 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 ___
[NTG-context] How to write readable source files?
Hi all, how do you format your ConTeXt source files? I recently discovered prettier which reformats source files for different markup and programming languages such as html, markdown, json etc. There are some other tools around but I don't find anything for ConTeXt. Do you know of any prettifying tool? Is there a best practice for ConTeXt source files, at all? Ciao! Jan Ulrich Hasecke ___ 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 ___
Re: [NTG-context] How to write readable source files?
>> Is there a best practice for ConTeXt source files, at all? Readable code is not just about formatting. Adding clear and complete comments that document the code can be considered even more important. dr. Hans van der Meer > On 24 Apr 2021, at 13:55, Henning Hraban Ramm wrote: > > >> Am 24.04.2021 um 11:45 schrieb Jan U. Hasecke : >> >> Do you know of any prettifying tool? > > I don’t know one. > >> Is there a best practice for ConTeXt source files, at all? > > I guess many of us adhere to Hans’ style, as shown in the sources. > > i.e. e.g. > \setupsomething > [name] > [key=value, > otherkey=value] > > while I prefer: > > \setupsomething[name][ > key=value, > otherkey=value, > ] > > That looks clearer to me and works a bit better with automatic indenting in > editors. > > But source code formatting is a matter of taste in most cases. > > Hraban > ___ > 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 ___
[NTG-context] Fwd: Corrupt PDF files with LMTX?
-- Forwarded message - De: Jairo A. del Rio Date: sáb, 24 de abr. de 2021 a la(s) 08:05 Subject: Re: [NTG-context] Corrupt PDF files with LMTX? To: Hans Hagen The following: \starttext \startMPpage fill fullcircle scaled 1cm withcolor red \stopMPpage \stoptext gives Error: stream Length incorrect. Output may be incorrect. Error: stream Length incorrect. Output may be incorrect. However, an image is generated. However, when it includes text, the message above appears. As Thomas says, it happens even with simple documents. Jairo El sáb, 24 de abr. de 2021 a la(s) 01:36, Hans Hagen (j.ha...@xs4all.nl) escribió: > On 4/24/2021 8:03 AM, Jairo A. del Rio wrote: > > Hi, list! > > When I try to convert a PDF generated by ConTeXt LMTX to PNG using > > ImageMagick's convert the following happens: > hard to handle when there is no mwe ... > > 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 ___
Re: [NTG-context] How to write readable source files?
On Sat, Apr 24, 2021 at 11:53 AM Jan U. Hasecke wrote: > > Hi all, > > how do you format your ConTeXt source files? > > I recently discovered prettier which reformats source files for > different markup > and programming languages such as html, markdown, json etc. > > There are some other tools around but I don't find anything for ConTeXt. > > Do you know of any prettifying tool? > > Is there a best practice for ConTeXt source files, at all? > > you should consider that in TeX (but also in Python, for example) spaces matter. Sometimes unwanted results are triggered by unseen blanks, and they are hard to discover. -- luigi ___ 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 ___
Re: [NTG-context] How to write readable source files?
> Am 24.04.2021 um 11:45 schrieb Jan U. Hasecke : > > Do you know of any prettifying tool? I don’t know one. > Is there a best practice for ConTeXt source files, at all? I guess many of us adhere to Hans’ style, as shown in the sources. i.e. e.g. \setupsomething [name] [key=value, otherkey=value] while I prefer: \setupsomething[name][ key=value, otherkey=value, ] That looks clearer to me and works a bit better with automatic indenting in editors. But source code formatting is a matter of taste in most cases. Hraban ___ 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 ___
Re: [NTG-context] Corrupt PDF files with LMTX?
On 24.04.21 08:03, Jairo A. del Rio wrote: Hi, list! When I try to convert a PDF generated by ConTeXt LMTX to PNG using ImageMagick's convert the following happens: Error: stream Length incorrect. Output may be incorrect. Error: An error occurred while reading an XREF table. The file has been damaged. This may have been caused by a problem while converting or transfering the file. Ghostscript will attempt to recover the data. However, the output may be incorrect. Error: /ioerror in --runpdf-- Operand stack: post_eof_count 4096 --nostringval-- 4571 Execution stack: %interp_exit .runexec2 --nostringval-- runpdf --nostringval-- 2 %stopped_push --nostringval-- runpdf runpdf false 1 %stopped_push 1990 1 3 %oparray_pop 1989 1 3 %oparray_pop 1977 1 3 %oparray_pop 1978 1 3 %oparray_pop runpdf runpdf runpdf runpdf runpdf runpdf runpdf Dictionary stack: --dict:735/1123(ro)(G)-- --dict:1/20(G)-- --dict:80/200(L)-- --dict:80/200(L)-- --dict:135/256(ro)(G)-- --dict:315/325(ro)(G)-- --dict:28/32(L)-- Current allocation mode is local GPL Ghostscript 9.50: Unrecoverable error, exit code 1 convert-im6.q16: FailedToExecuteCommand `'gs' -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=5 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r300x300' '-sOutputFile=/tmp/magick-55690XUwDR8veJQEc%d' '-f/tmp/magick-55690zbxNvSPCVCYe' '-f/tmp/magick-55690aVvG11u3p8wd'' (1) @ error/pdf.c/InvokePDFDelegate/291. convert-im6.q16: no images defined `151.png' @ error/convert.c/ConvertImageCommand/3258. I'd blame ImageMagick, except for the fact that 1) other converters fail too and 2) it doesn't happen with ConTeXt MkIV (PDF is successfully converted). Cordially, Jairo Very interesting! I have seen similar behavior these past days (I think it's very recent) but thought it was something in my documents. Hans, MWE: I have two test files, simply with \starttext Test \stoptext I try to concatenate the resulting pdf files with qpdf: qpdf test1.pdf --pages test1.pdf test2.pdf -- result.pdf And I get these warnings (though the resulting file appears to be OK): WARNING: test1.pdf (xref stream: object 18 0, offset 4154): expected endstream WARNING: test1.pdf (xref stream: object 18 0, offset 4078): attempting to recover stream length WARNING: test1.pdf (xref stream: object 18 0, offset 4078): recovered stream length: 64 WARNING: test1.pdf (object 3 0, offset 4179): expected endstream WARNING: test1.pdf (object 3 0, offset 2982): attempting to recover stream length WARNING: test1.pdf (object 3 0, offset 2982): recovered stream length: 887 WARNING: test2.pdf (xref stream: object 18 0, offset 4215): expected endstream WARNING: test2.pdf (xref stream: object 18 0, offset 4139): attempting to recover stream length WARNING: test2.pdf (xref stream: object 18 0, offset 4139): recovered stream length: 65 WARNING: test2.pdf (object 3 0, offset 4241): expected endstream WARNING: test2.pdf (object 3 0, offset 3050): attempting to recover stream length WARNING: test2.pdf (object 3 0, offset 3050): recovered stream length: 880 qpdf: operation succeeded with warnings; resulting file may have some problems ___ 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 ___
Re: [NTG-context] new page before xtable with repeated headers
Thank you Hans, this works well in my unchanged MWE - I'll do some more rigorous testing on monday and let you know. Thanks a lot and hava a nice weekend! Werner Am 23.04.21 um 21:28 schrieb Hans Hagen: Always tricky this (on my agenda is to look into the engines page builder ...) You can put this on cont-new.mkxl as test: \unprotect \defcsname\??xtableflushsplit\v!repeat\endcsname {\doloop {\clf_x_table_flush method {\v!split}% height \ifdim\pagegoal=\maxdimen\textheight\else\dimexpr\pagegoal-\pagetotal\relax\fi \relax \ifcase\c_tabl_x_state \exitloop \else \page \fi}} \protect Please test a lot! I also needs Wolfgangs opinion on this. Maybe preceding whitespace can interfere so maybe we need some 'slack' parameter. Hans ___ 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 ___