Hello, I'd need to show contents of a (text) file like verbatim text (with a monospace font). So to do something being described at http://wiki.contextgarden.net/Verbatim_text using \startcode SOME TEXT \stop code, but the difference is that I don't need to write SOME TEXT manually but I need to load it from a (text) file. Moreover, I'd need to have the following options: - To alter the font used for numbering lines, so that it would be smaller than the normal text. - To specify number of the first and/or last line to be printed. - The input file may contain the end-of-page character, \0C. So I'd need this char - to be ignored - and/or to force printing from a new page. Is there a ConTeXt command which would provide all above? (NB: When I worked with LaTeX, these features were mostly provided by \VerbatimInput command from "fancyvrb" package.) Kind regards, Lukáš -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
Am 2010-10-01 um 09:51 schrieb Procházka Lukáš Ing. - Pontex s. r. o.:
I'd need to show contents of a (text) file like verbatim text (with a monospace font).
So to do something being described at http://wiki.contextgarden.net/Verbatim_text using \startcode SOME TEXT \stop code, but the difference is that I don't need to write SOME TEXT manually but I need to load it from a (text) file.
At Verbatim_text you overlooked the small hint to \typefile: http://wiki.contextgarden.net/Reference/en/typefile (also mentioned at http://wiki.contextgarden.net/Reference/en/starttyping)
Moreover, I'd need to have the following options: - To alter the font used for numbering lines, so that it would be smaller than the normal text.
\definetyping[MyStyle] \setuptyping[MyStyle][style={\tfx\tt}] see http://wiki.contextgarden.net/Reference/en/setuptyping Doesn't look like you really searched the wiki...
- To specify number of the first and/or last line to be printed.
I remember something like that, please search the mailing list archive and add your findings to the wiki pages.
- The input file may contain the end-of-page character, \0C. So I'd need this char - to be ignored - and/or to force printing from a new page.
I don't know, never used ...typing myself. Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)
Am 2010-10-01 um 11:06 schrieb Henning Hraban Ramm:
Moreover, I'd need to have the following options: - To alter the font used for numbering lines, so that it would be smaller than the normal text.
\definetyping[MyStyle] \setuptyping[MyStyle][style={\tfx\tt}]
Sorry, I guess I misunderstood you: You mean the font of the numbers? I've no clue - don't know what i/v/ccommand can do (perhaps only coloring some word classes), try it yourself or look in the sources: http://source.contextgarden.net/tex/context/base/verb-ini.mkii Maybe the settings of \setuplinenumbering also affect \...typing: http://wiki.contextgarden.net/Reference/en/setuplinenumbering (Don't know how you can change the number font with it, though.) Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)
Hello,
Sorry, I guess I misunderstood you: You mean the font of the numbers?
I mean font (or or its size) used for printing for line numbers - see http://ftp.cstug.cz/pub/CTAN/macros/latex/contrib/fancyvrb/fancyvrb.pdf, pg. 11: line numbers which are turned on by "numbers=left" are printed with small (xsmall?) font; that's what I'm trying to achieve. - I'll try to look into wiki.ctx.
I've no clue - don't know what i/v/ccommand can do (perhaps only coloring some word classes), try it yourself or look in the sources: http://source.contextgarden.net/tex/context/base/verb-ini.mkii
Maybe the settings of \setuplinenumbering also affect \...typing: http://wiki.contextgarden.net/Reference/en/setuplinenumbering
- I'll try it. Cheers, Lukas
(I doubled this message to reduce size of attachments. Although the t.pdf.png is not very good, I believe it's enough to imagine proportions of letter height vs. line height and line number vs. letter [used for typing] height.) ... I keep on trying. I applied all your previous advice. But I still don't get everything I'd need. There's a sample attached. --- \definetyping[xFn] \setuptyping[xFn][style={\tfxx\tt},space=off,blank=halfline,numbering=line] % Trials - what each parameter actually does \starttext AAA \bgroup \setuplinenumbering[style={\small\boldslanted}] \typefile[xFn]{Data.txt} \egroup BBB \stoptext --- Problems are: - The space between lines should be smaller. If I select two lines in AR, I can see a gap between them. So at least, I'd like to omit this gap. Compare ListFile.pdf (<- Ctx) to t.pdf (<- LaTeX, which I was used to use). I don't know how to change it - whether via \setuptyping or how. (At wiki, there are descriptions for command parameters missing ("(i/v/c)command"), and some of them are mentioned twice ("space", "page").) - - Or to use "(i/v/c)command" somehow? - - Or the new line height should be changed by \setupbodyfont? - I tried \setuplinenumbering as well. It works somehow like I'd need, but if you look at ListFile.pdf, you'll see settings are lost when a new page starts (?). Any idea how to "get closer look" of ListFile.pdf to t.pdf? (I mean just line height and the manner how lines are numbered.) Thank you for patience. Lukas -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
participants (2)
-
Henning Hraban Ramm
-
Procházka Lukáš Ing. - Pontex s. r. o.