From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/106722 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Geert Dobbels Newsgroups: gmane.comp.tex.context Subject: xtable headers and handlecsv loop Date: Fri, 3 Apr 2020 11:57:24 +0200 Message-ID: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3832955454485864324==" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="102250"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Fri Apr 03 11:58:10 2020 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jKJ5W-000QUP-Bf for gctc-ntg-context-518@m.gmane-mx.org; Fri, 03 Apr 2020 11:58:10 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 1C0DC182E2A; Fri, 3 Apr 2020 11:57:32 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rBVxZfWnXPi8; Fri, 3 Apr 2020 11:57:31 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 22F57182FCE; Fri, 3 Apr 2020 11:57:31 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 78FFC182F25 for ; Fri, 3 Apr 2020 11:57:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dh4w5Ruz5yIs for ; Fri, 3 Apr 2020 11:57:29 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.221.51; helo=mail-wr1-f51.google.com; envelope-from=dobbels.geert@googlemail.com; receiver= Original-Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id D7A1A182E2A for ; Fri, 3 Apr 2020 11:57:29 +0200 (CEST) Original-Received: by mail-wr1-f51.google.com with SMTP id h9so7772884wrc.8 for ; Fri, 03 Apr 2020 02:57:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:subject:message-id:date:user-agent:mime-version :content-language; bh=in7OOc76WS5E5iVt7rDPt2wrNtKHmA6UDm6MkMPhgi8=; b=NMQ6GgxXKci5YbgwaULw2Pcudvbyq/r5xn1bx4nY90J+lNZDVD8YR+uJzOuxnwUxBe VYaEDL0Qz54MuJO7RTamrMgBgyZ084XO1bZqgbX52gEqrmVc/Ep6fsM2ZLNw6G0bCng/ zkruhBSYhcgJu/lqtoXf7bIwflYTb3AtZ2YpjpUwb1snnJ2Xhv8Rio/AepvBcxMSCUPt /KlGLGdP94AH3b765LQJA0+zHlPxcD3evDWBtVMLcAyptF53AKptbXQZAz/ssWOXsyMf BriSIYXiqLU3+stjJjmtiXt48ebip7axFQhHq+EIc0KxugROd06ZiVLg0Tl0WVGaI3G8 zA7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:message-id:date:user-agent :mime-version:content-language; bh=in7OOc76WS5E5iVt7rDPt2wrNtKHmA6UDm6MkMPhgi8=; b=klBZSh0Yr1xT8/pLcS+w3FKIu00E1MrsEuJrvd4KFmDX6GMn4cKJwqfPkIbwF+sYia 0hX8DuX8sWe+Lam8rHTSLc1KxS3NLOXwjVFp26cnVaEpdy76XKYrJvaLOmMfWvd6Uskz 6HF0M3MCmDLLJB/wW2dBhPleJ2ZjFEWwXi06B4lUnRitc0ZKUBtMh0L1U7KNCWkaWdX6 gX/N/Y05u9skoJM7FM/iJvbYMXh5cNVhnQLHzyrFOGGX6HXpT9yqqJYjgM/DKWnDOY/q hzzIJwGjoWB7j88SDS/AExRywdYHrDLb6eawntelSCoACMafeU7jmP2+xy5V/sYZZrpB xLTw== X-Gm-Message-State: AGi0PuZQE/E9okULSaLpuksKeLCFm1BG1mmNoBiADHUGescRbtSYCgW2 dsXAT2B2HpEflgZNJkJjsVt9dU/W X-Google-Smtp-Source: APiQypKohas1TWWQ5PDTHQoJoqxhxw6pafF4lXGp1akDrzQqNYcMChTtr8KgPsZXracFxusfo+MwUg== X-Received: by 2002:a5d:4e03:: with SMTP id p3mr7977648wrt.408.1585907848832; Fri, 03 Apr 2020 02:57:28 -0700 (PDT) Original-Received: from [192.168.1.49] (186.red-80-39-46.staticip.rima-tde.net. [80.39.46.186]) by smtp.googlemail.com with ESMTPSA id d1sm11787265wrm.86.2020.04.03.02.57.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Apr 2020 02:57:28 -0700 (PDT) X-Google-Original-From: Geert Dobbels Content-Language: en-US X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:106722 Archived-At: This is a multi-part message in MIME format. --===============3832955454485864324== Content-Type: multipart/alternative; boundary="------------B80ADA217E9A77F9F60C0F2F" Content-Language: en-US This is a multi-part message in MIME format. --------------B80ADA217E9A77F9F60C0F2F Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Hello, The sample below has 2 problems I cannot find the solution for: I am reading a table from a CSV file and want to typeset it via \xtable. The xtable as defined below works, it splits over several pages, but the header does not repeat. I have seen examples in the mailing list where people put the "\startxtable.....\stopxtable" within a \placefigure, but as soon as I try this, I get an error message: "missing } or endgroup", although I doublechecked the "}" and I see no error. The other issue I have: Since xtable requires me to read the header line separately in order to put it between \startxtablehead and \stopxtablehead, I access the csv buffer twice: the first time, I only read the first line, and the second time, I read starting from the second line. My problem here is that I do not know beforehand the number of lines in the csv file. So in my second \doloopfromto I give the second argument a number high enough to be sure it reads all the lines. It works fine, but I would like to know if there is a way to read the number of lines in the csv file to use the exact number of lines, instead of guessing. \usemodule[handlecsv] \opencsvfile{systaprov2.csv} \starttext \startbuffer[loop] \startxrow \startxcell[left] \cA \stopxcell \startxcell[left] \cB \stopxcell \startxcell[left] \cC \stopxcell \startxcell[left] \cD \stopxcell \startxcell \cE \stopxcell \startxcell[left] \cF \stopxcell \startxcell \cG \stopxcell \startxcell \cH \stopxcell \doifdefined{cI}{\startxcell \cI \stopxcell} \doifdefined{cJ}{\startxcell \cJ \stopxcell} \doifdefined{cK}{\startxcell [left] \cK \stopxcell} \stopxrow \stopbuffer \setupxtable[offset=0cm, frame=off, bottomframe=on, framecolor=gray, option=stretch, align=middle] \setupxtable[head][background=color, backgroundcolor=gray, topframe=on, bottomframe=on, framecolor=black, foregroundcolor=blue] \setupxtable[left][align=right] \startxtable[header=repeat] \startxtablehead[head] \doloopfromto{1}{1}{\getbuffer[loop]} \stopxtablehead \startxtablebody \doloopfromto{2}{500}{\getbuffer[loop]} \stopxtablebody \stopxtable \stoptext --------------B80ADA217E9A77F9F60C0F2F Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

Hello,

The sample below has 2 problems I cannot find the solution for:

I am reading a table from a CSV file and want to typeset it via \xtable.

The xtable as defined below works, it splits over several pages, but the header does not repeat. I have seen examples in the mailing list where people put the "\startxtable.....\stopxtable" within a \placefigure, but as soon as I try this, I get an error message: "missing } or endgroup", although I doublechecked the "}" and I see no error.

The other issue I have: Since xtable requires me to read the header line separately in order to put it between \startxtablehead and \stopxtablehead, I access the csv buffer twice: the first time, I only read the first line, and the second time, I read starting from the second line. My problem here is that I do not know beforehand the number of lines in the csv file. So in my second \doloopfromto I give the second argument a number high enough to be sure it reads all the lines. It works fine, but I would like to know if there is a way to read the number of lines in the csv file to use the exact number of lines, instead of guessing.

\usemodule[handlecsv]


\opencsvfile{systaprov2.csv}

\starttext


\startbuffer[loop]

\startxrow

\startxcell[left] \cA \stopxcell

\startxcell[left] \cB \stopxcell

\startxcell[left] \cC \stopxcell

\startxcell[left] \cD \stopxcell

\startxcell \cE \stopxcell

\startxcell[left] \cF \stopxcell

\startxcell \cG \stopxcell

\startxcell \cH \stopxcell

\doifdefined{cI}{\startxcell \cI \stopxcell}

\doifdefined{cJ}{\startxcell \cJ \stopxcell}

\doifdefined{cK}{\startxcell [left] \cK \stopxcell}

\stopxrow

\stopbuffer

\setupxtable[offset=0cm,

frame=off,

bottomframe=on,

framecolor=gray,

option=stretch,

align=middle]

\setupxtable[head][background=color,

backgroundcolor=gray,

topframe=on,

bottomframe=on,

framecolor=black,

foregroundcolor=blue]

\setupxtable[left][align=right]

\startxtable[header=repeat]

\startxtablehead[head]

\doloopfromto{1}{1}{\getbuffer[loop]}

\stopxtablehead

\startxtablebody

\doloopfromto{2}{500}{\getbuffer[loop]}

\stopxtablebody

\stopxtable

\stoptext

--------------B80ADA217E9A77F9F60C0F2F-- --===============3832955454485864324== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============3832955454485864324==--