From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31027 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Richard Huntsinger Newsgroups: gmane.text.pandoc Subject: Re: Jupyter-to-LaTex | How to render tables? Date: Tue, 19 Jul 2022 10:17:06 -0700 (PDT) Message-ID: References: <6c82ec4b-d697-41a6-9192-2a84945e0850n@googlegroups.com> <5299A394-419C-4839-B528-46D002AF3371@gmail.com> <1568e512-a488-495c-a82d-aedec432d0acn@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_12940_1274508758.1658251026911" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30450"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCFYNC6M64FBBFGO3OLAMGQE3AGQXHA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Jul 19 19:17:13 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-yw1-f185.google.com ([209.85.128.185]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oDqqN-0007f9-Og for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 19 Jul 2022 19:17:12 +0200 Original-Received: by mail-yw1-f185.google.com with SMTP id 00721157ae682-31cb93cadf2sf124624747b3.11 for ; Tue, 19 Jul 2022 10:17:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=OzrnG6rDte8iIBBe3iK/7ZNDgivXUhPJxrn3KeH0Dz4=; b=XTpE4BHd1QUe1CrAU3WlCB+IYvDfkcnDdbLdQIqtQoTq3xfLHwKNXgLprbnTFmHUPQ Y03C1B09x96aaXl930ow8GF4s6gNSy9852K2ub89vgrqlC7zgBOKWBUCK7NfAIXdWCkR /VHrvVQhTPbujtkwJo6ANMMxprcwA0kHZv/zMLaxWfOq6Xxzw1OMs9M30Msc4s2gAwtf cHv5As//n/Plb4kQJkusTvxholJJOTJGUGA6gwjbkRtdgieBUrX7lQCuaI17E9U1jU9A 5j/4lj2sJQw4g0zKR2IeHx7zC97beVOSWY8xBx/OnLAFsCCaOooDXL6LRbqr87q5cIQ/ t1ag== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=berkeley.edu; s=google; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=OzrnG6rDte8iIBBe3iK/7ZNDgivXUhPJxrn3KeH0Dz4=; b=rXigR5waE31wqHi8QOXT/9aDSDGDK5vwR1jzC11MlM62mMg7ueBYsrXnT/F4mcEdeQ LxQEVwj6NAtato9mYmK+Uex2osZ9aYjhj03pmakgfnki7hnKmWpovQo/Ueczvpp6L6rI ESxtlHUJNiwwnJ4fGfJ5X7yRTU6GHE0q/t0ptjserMe9ZUPw8/ptBM4VdL6FlpAPhyQy HLaDWJIk6nnmAcu5ifepocCGRY9ICg1SYKc1O4OmjMzHYUdR9VogzgF3zh+j4MqHA1CG v9xvL/ONe1PidSPjhK+DVyqgEmgdfNTsmtZRducd7NfAGa1/37FGDWsVK/KnNLgvkdQs VUTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=OzrnG6rDte8iIBBe3iK/7ZNDgivXUhPJxrn3KeH0Dz4=; b=1TVrXf7sOa0asq9c7GhrZvmmF9GSNB3CjJw4MFd9owWAnGd++XmUjfv9pxLWNsg6Nq 2uFZeN0NewJsSX35g6dRSwiSJcTgMIXwCZ5dEA8RIZUdjvzhG4+v1Un0M0/lcDlE+58F U5LVWESx5vPW+to0ZGlwUk+WyX2AWR53BxV6cVM7onZRsPfrxvdtkqP+qsJqGOwjLuD1 e+AmTuayd438OlJHRk9GMigHhg0GN6p9YgMXPPYR7mC7yUzo0k8gULXNgZiz4q9oVdW3 U7IoHOlwHQd9dsbqe1XcTHwMtQPrF8aGb/ARmBidNd6WfypnnAp/0J3yfsqTCSxbn+Mt iy+A== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AJIora83Oye9TEO0+i528L03wBMVaNNamX4toGGIHHaKuEPGxdTbRXgD MAHlwKKJlZggdlFqB3+zEco= X-Google-Smtp-Source: AGRyM1vbryctB4Lq+ViaOsjg2i2qteoo6cKz61yOoSHNrD1GmBc6TPDb18FVolAhU3KdiKeKUAl9iQ== X-Received: by 2002:a25:d93:0:b0:66f:80cb:390a with SMTP id 141-20020a250d93000000b0066f80cb390amr34844117ybn.135.1658251030797; Tue, 19 Jul 2022 10:17:10 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:690c:d:b0:2ff:2e35:3394 with SMTP id bc13-20020a05690c000d00b002ff2e353394ls363383ywb.9.-pod-prod-gmail; Tue, 19 Jul 2022 10:17:08 -0700 (PDT) X-Received: by 2002:a81:58c1:0:b0:31d:6b54:3fd5 with SMTP id m184-20020a8158c1000000b0031d6b543fd5mr37320751ywb.7.1658251027509; Tue, 19 Jul 2022 10:17:07 -0700 (PDT) In-Reply-To: <1568e512-a488-495c-a82d-aedec432d0acn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: rhuntsinger-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:31027 Archived-At: ------=_Part_12940_1274508758.1658251026911 Content-Type: multipart/alternative; boundary="----=_Part_12941_886386347.1658251026911" ------=_Part_12941_886386347.1658251026911 Content-Type: text/plain; charset="UTF-8" The following lua code does the trick - it captures Jupyter's html tables and converts them to latex tables for rendering in PDF. function RawBlock (raw) if raw.format:match 'html' then return pandoc.read(raw.text, 'html').blocks end end New problem exposed, though. Nested tables are not converted properly. I'll treat this conversation re: adjusting for html code as resolved, and I'll open a new conversation re: converting nested tables. On Monday, July 18, 2022 at 6:40:36 PM UTC-7 Richard Huntsinger wrote: > Thank you much, fiddlosopher, for your quick reply. Clearly, I need make > use of lua filters to adjust for the HTML code in my Jupyter notebooks. > I've now read the lua documentation and tried some of the examples on the > pandoc doc site and pandoc/lua-filters repository - but I don't see an > example of how to search for and transform HTML-format tables to native > pandoc-format tables, or similar such thing. Can you provide me some > additional guidance? > > On Monday, July 18, 2022 at 12:54:17 AM UTC-7 fiddlosopher wrote: > >> Raw HTML in a Markdown document (which is apparently what the R >> display_html function produces) will not be passed through to PDF. >> Similarly, raw LaTeX will not be passed through to HTML. >> >> One approach might be to generate *both* formats in your notebook. You >> could try that. >> >> Another approach would be to use a Lua filter that matches raw HTML >> blocks and uses pandoc.read to convert them to native pandoc tables, which >> could then be rendered in PDF. I believe there are examples of such filters >> either in the Lua filters documentation, or in the pandoc/lua-filters >> repository, or on this list. If you can't see how to do it, just ask. >> >> >> -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/ebb070e8-7bcc-4584-b142-5a4a150def08n%40googlegroups.com. ------=_Part_12941_886386347.1658251026911 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable The following lua code does the trick - it captures Jupyter's html tables a= nd converts them to latex tables for rendering in PDF.

f= unction RawBlock (raw)
    if raw.format:match 'html' then 
  &nbs= p;     return pandoc.read(raw.text, 'html').blocks 
    end 
end

New problem expos= ed, though.  Nested tables are not converted properly.  I'll trea= t this conversation re: adjusting for html code as resolved, and I'll open = a new conversation re: converting nested tables.
On Monday, July 18, 2022 at 6:= 40:36 PM UTC-7 Richard Huntsinger wrote:
Thank you much, fiddlosopher, for your quick re= ply.=C2=A0 Clearly, I need make use of lua filters to adjust for the HTML c= ode in my Jupyter notebooks.=C2=A0 I've now read the lua documentation = and tried some of the examples on the pandoc doc site and pandoc/lua-filter= s repository - but I don't see an example of how to search for and tran= sform HTML-format tables to native pandoc-format tables, or similar such th= ing.=C2=A0 Can you provide me some additional guidance?=C2=A0 =C2=A0
On Monda= y, July 18, 2022 at 12:54:17 AM UTC-7 fiddlosopher wrote:
Raw HTML in a Markdown document (which = is apparently what the R display_html function produces) will not be passed= through to PDF. Similarly, raw LaTeX will not be passed through to HTML.

One approach might be to generate *both* formats in your notebook. You= could try that.

Another approach would be to use a Lua filter that matches raw HTML blo= cks and uses pandoc.read to convert them to native pandoc tables, which cou= ld then be rendered in PDF. I believe there are examples of such filters e= ither in the Lua filters documentation, or in the pandoc/lua-filters reposi= tory, or on this list. If you can't see how to do it, just ask.


--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/ebb070e8-7bcc-4584-b142-5a4a150def08n%40googlegroups.= com.
------=_Part_12941_886386347.1658251026911-- ------=_Part_12940_1274508758.1658251026911--