ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Verbatim text loaded from a file?
@ 2010-10-01  7:51 Procházka Lukáš Ing. - Pontex s. r. o.
  2010-10-01  9:06 ` Henning Hraban Ramm
  0 siblings, 1 reply; 5+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2010-10-01  7:51 UTC (permalink / raw)
  To: ConTeXt

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

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Verbatim text loaded from a file?
  2010-10-01  7:51 Verbatim text loaded from a file? Procházka Lukáš Ing. - Pontex s. r. o.
@ 2010-10-01  9:06 ` Henning Hraban Ramm
  2010-10-01  9:38   ` Henning Hraban Ramm
  0 siblings, 1 reply; 5+ messages in thread
From: Henning Hraban Ramm @ 2010-10-01  9:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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)

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Verbatim text loaded from a file?
  2010-10-01  9:06 ` Henning Hraban Ramm
@ 2010-10-01  9:38   ` Henning Hraban Ramm
  2010-10-01  9:48     ` Procházka Lukáš Ing. - Pontex s. r. o.
  2010-10-04 11:14     ` Verbatim text loaded from a file? (reduced attachments) Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 2 replies; 5+ messages in thread
From: Henning Hraban Ramm @ 2010-10-01  9:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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}]
>
> see http://wiki.contextgarden.net/Reference/en/setuptyping

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)

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Verbatim text loaded from a file?
  2010-10-01  9:38   ` Henning Hraban Ramm
@ 2010-10-01  9:48     ` Procházka Lukáš Ing. - Pontex s. r. o.
  2010-10-04 11:14     ` Verbatim text loaded from a file? (reduced attachments) Procházka Lukáš Ing. - Pontex s. r. o.
  1 sibling, 0 replies; 5+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2010-10-01  9:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Verbatim text loaded from a file? (reduced attachments)
  2010-10-01  9:38   ` Henning Hraban Ramm
  2010-10-01  9:48     ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2010-10-04 11:14     ` Procházka Lukáš Ing. - Pontex s. r. o.
  1 sibling, 0 replies; 5+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2010-10-04 11:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 1783 bytes --]

(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

[-- Attachment #2: ListFile.pdf --]
[-- Type: application/pdf, Size: 16597 bytes --]

[-- Attachment #3: ListFile.ctx --]
[-- Type: application/octet-stream, Size: 234 bytes --]

\definetyping[xFn]
\setuptyping[xFn][style={\tfxx\tt},space=off,blank=halfline,numbering=line]

\starttext

  AAA

  \bgroup
    \setuplinenumbering[style={\small\boldslanted}]
    \typefile[xFn]{Data.txt}
  \egroup

  BBB

\stoptext

[-- Attachment #4: Data.txt --]
[-- Type: text/plain, Size: 5015 bytes --]

;          x           N         Q.z         M.y         M.x         Q.y         M.z
;-----------------------------------------------------------------------------------
      0.0000   -3416.449   -1651.706   27894.604    -869.173     430.867  -16414.600
      3.0844   -3325.373   -1633.100   22827.009    -869.173     425.438  -15093.900
      6.1687   -3200.770   -1604.710   17833.992    -869.173     420.010  -13790.100
      6.1688   -3279.292   -1437.453   17833.992    -156.624     420.010  -13816.500
      9.1097   -3120.177   -1404.341   13652.607    -156.624     414.834  -12589.000
     12.0506   -2905.161   -1352.015    9587.269    -156.624     409.658  -11376.510
     12.0507   -2978.216   -1182.430    9587.269     498.940     409.658  -11366.720
     14.4270   -2914.918   -1006.134    6920.957     498.940     405.475  -10398.189
     16.8034   -2830.449    -727.440    4897.044     498.940     401.293   -9439.558
     16.8035   -2866.365    -569.714    4897.044    1020.475     401.293   -9397.477
     19.0850   -2208.133     557.079    4259.359    1020.475     397.277   -8486.465
     21.3665    -994.667    1271.006    6221.377    1020.475     393.262   -7584.653
     21.3666     -49.916    -116.928    6301.710      77.906     272.965   -6622.572
     23.5687    -152.360     -79.288    6097.738      77.906     269.090   -6025.638
     25.7709    -423.902      19.001    6032.022      77.906     265.214   -5437.370
     25.7710    -422.265      41.799    6032.022     370.594     265.214   -5425.256
     27.9054    -696.361     157.370    6259.236     370.594     261.457   -4863.161
     30.0399    -937.585     263.519    6707.942     370.594     257.700   -4309.083
     30.0400    -922.347     312.703    6707.942     597.812     257.700   -4283.443
     32.1176   -1207.173     455.017    7513.746     597.812     254.044   -3751.844
     34.1952   -1454.706     570.953    8584.913     597.812     250.387   -3227.841
     34.1953   -1422.156     647.787    8584.913     769.254     250.387   -3191.293
     36.2241   -1614.126     741.014    9996.889     769.254     246.816   -2686.922
     38.2529   -1745.240     833.557   11620.956     769.254     243.245   -2189.793
     38.2530   -1222.308    -441.840   11640.434     464.106     173.575   -1900.743
     40.2440   -1308.993    -417.752   10784.231     464.106     170.071   -1558.616
     42.2351   -1401.340    -388.728    9980.041     464.106     166.566   -1223.468
     42.2352   -1419.180    -317.477    9980.041     525.288     166.566   -1198.533
     44.1934   -1579.042    -249.812    9420.514     525.288     163.120    -875.645
     46.1517   -1756.133    -164.246    9003.948     525.288     159.673    -559.625
     46.1518   -1762.114     -77.002    9003.948     552.380     159.673    -532.902
     48.0835   -1968.614      49.052    8968.947     552.380     156.273    -227.730
     50.0153   -2173.197     183.967    9192.566     552.380     152.873      70.873
     50.0154   -2162.525     283.056    9192.566     548.566     152.873      96.035
     51.9274   -2340.263     416.072    9861.002     548.566     149.508     385.128
     53.8396   -2469.880     512.331   10749.448     548.566     146.143     667.789
     53.8397   -2232.824    -766.571   10753.281     339.339      83.349     828.191
     55.7369   -2305.306    -731.436    9327.294     339.339      80.010     983.162
     57.6342   -2393.210    -678.205    7981.230     339.339      76.671    1131.797
     57.6343   -2421.041    -570.950    7981.230     288.598      76.671    1145.787
     59.5203   -2545.382    -463.866    6991.737     288.598      73.351    1287.270
     61.4065   -2667.286    -325.240    6238.640     288.598      70.031    1422.493
     61.4066   -2679.212    -204.956    6238.640     224.332      70.031    1434.033
     63.2853   -3437.724     178.736    6181.967     224.332      66.724    1562.504
     65.1642   -3509.248     357.117    6696.394     224.332      63.418    1684.763
     65.1643   -3490.866     506.182    6696.394     152.408      63.418    1692.785
     67.0396   -3520.976     642.641    7795.414     152.408      60.117    1808.653
     68.9150   -3530.228     754.189    9114.729     152.408      56.816    1918.310
     68.9151   -3530.034    -745.082    9114.729    -153.353     -56.902    1918.113
     70.7905   -3521.065    -643.186    7795.417    -153.353     -60.202    1808.356
     72.6659   -3491.041    -506.790    6696.387    -153.353     -63.503    1692.307
     72.6660   -3509.452    -357.718    6696.387    -225.257     -63.503    1684.244
     74.5447   -3436.481    -176.103    6181.953    -225.257     -66.810    1561.828
     76.4235   -2679.629     204.348    6238.643    -225.257     -70.117    1433.198
     76.4236   -2667.730     324.652    6238.643    -289.483     -70.117    1421.618
     78.3097   -2545.901     463.357    6991.737    -289.483     -73.436    1286.235
     80.1959   -2421.618     570.509    7981.221    -289.483     -76.756    1144.593

[-- Attachment #5: t.pdf.png --]
[-- Type: image/png, Size: 12078 bytes --]

[-- Attachment #6: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-10-04 11:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-01  7:51 Verbatim text loaded from a file? Procházka Lukáš Ing. - Pontex s. r. o.
2010-10-01  9:06 ` Henning Hraban Ramm
2010-10-01  9:38   ` Henning Hraban Ramm
2010-10-01  9:48     ` Procházka Lukáš Ing. - Pontex s. r. o.
2010-10-04 11:14     ` Verbatim text loaded from a file? (reduced attachments) Procházka Lukáš Ing. - Pontex s. r. o.

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).