From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31052 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Richard Huntsinger Newsgroups: gmane.text.pandoc Subject: Re: How to size images? Date: Thu, 21 Jul 2022 13:35:53 -0700 (PDT) Message-ID: References: <7aa4ae72-1fae-49a3-bb91-035b78b92dean@googlegroups.com> <87tu7bdbfl.fsf@zeitkraut.de> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_688_144568873.1658435753774" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21686"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCFYNC6M64FBBK7R42LAMGQEXUPLLZA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Jul 21 22:35:59 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-yw1-f187.google.com ([209.85.128.187]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oEctq-0005MQ-H8 for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 21 Jul 2022 22:35:59 +0200 Original-Received: by mail-yw1-f187.google.com with SMTP id 00721157ae682-31e9b1be83esf5638447b3.8 for ; Thu, 21 Jul 2022 13:35:58 -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=/scJTLvPmfZaB66wF7O2fuy/oQOkQwcRkkT5nim2/n0=; b=ix9ntcIG47YJk1QDKbVyDwxkfjnW39L4Rewc8LZwGW8SUA/d0Dd5Ht/gh0px6cEyex NmS0s+dkZZxAi/gQ+jewuSYkXQ7TZRVu8K4QWDLqTD0PoLSJnMhXtiHV5KjiVR/fDKeK RYoFa5cQfqLynlCuzVCcl/J7ZGR71lYoP1XQsgM4e1gw6nWf13GMBF786eXJ8Ywh8C4i 5xrwZOektTWRTjMzaM1uHag3p8+mBcj0ol5cj91WhL++0AGH7Yu7M6bTxKo8XOyGu7mw tiyQjftQnIKQH2E5JMlkniAYqiYjLX8j/0qeWVLDFDK3jFxd3VjCGjFVVmdxD3j7/Pcd Cn9Q== 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=/scJTLvPmfZaB66wF7O2fuy/oQOkQwcRkkT5nim2/n0=; b=MOB9iRxPklG5ZiHcmuROBj9BUW3waA1g8m9QL8zwD0MUW+JOy6Yj8+I8KQjCsHt9s1 6ZO+sQp1+secfbfDQ4DCw6hKlYIlwD+3iaLMvRIB75KfXVY/Ubf9u/nGCbyq+zU91RP0 8YvMG7P96CmN5ZfirCI1XDHt4hctsUeqrToqAYCDotVgsqxczYwX3K9IO8P3rlvsZx2B ARDRIDAKnooLuI0Z66LHfOLQ9eXSvS+KfTvPrR8eEWi+RS1ynoAmthoRDioUpKOhV+9I xVD70s7Xl2WwCxhEsLOdicboRbEzB3e4dM4uR+fH9Cwf+apk0xLXY5fzL02tYLVOR6My Z/KQ== 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=/scJTLvPmfZaB66wF7O2fuy/oQOkQwcRkkT5nim2/n0=; b=CHLo1JMe4pkDOq7fSazkIn5n+bmel6z50smDS6KhQUXiwXObeNF0YNwmHpPqd/kAN5 JcRAjmaVds987uf0FwPKGJW0JNruDd+9oR3XyxSWVFkVmk2agaYxt5WglQParBrNsBdi mfMx+4sjPoV9tUerXbZM0ofs+Ry4fqHSQAAmcNzuK8ziX1+wV8P5uj3sa9XUvodD0II1 o60TR3BiVEtb9S3KkRBJ4g7lSFjIutQpNDBxSfepETDeL3iopTV0Mmw/wSxND1lyNTK7 Nh4XU3gy6l2h5W3tXli97mR0uzQIBBOvZEN25wbB1LuVomeXwZMRdFKZpLjvMDVSNnQv CCMQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AJIora+C5VngNW2LrpCMIKML2Dn15iyIjEGKl6N9wPDrd4S1oANKx9U2 w5F7UpYji1wBPHErVQLIw3c= X-Google-Smtp-Source: AGRyM1s+K/6mGQv5mqHxaTbKkIgwSWQEVdq4t3XYiDV5h3mKtO29ekwe3FHvtxB0NBoWAWAvxWBEDA== X-Received: by 2002:a5b:cc4:0:b0:66f:b23a:8edf with SMTP id e4-20020a5b0cc4000000b0066fb23a8edfmr339842ybr.418.1658435757406; Thu, 21 Jul 2022 13:35:57 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a81:52d0:0:b0:317:94a5:965e with SMTP id g199-20020a8152d0000000b0031794a5965els1977164ywb.0.-pod-prod-gmail; Thu, 21 Jul 2022 13:35:54 -0700 (PDT) X-Received: by 2002:a81:48c5:0:b0:31e:67b5:770d with SMTP id v188-20020a8148c5000000b0031e67b5770dmr299726ywa.189.1658435754392; Thu, 21 Jul 2022 13:35:54 -0700 (PDT) In-Reply-To: <87tu7bdbfl.fsf-9EawChwDxG8hFhg+JK9F0w@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:31052 Archived-At: ------=_Part_688_144568873.1658435753774 Content-Type: multipart/alternative; boundary="----=_Part_689_258350274.1658435753774" ------=_Part_689_258350274.1658435753774 Content-Type: text/plain; charset="UTF-8" Thanks, that works well. Another solution I've come to is to just display jpeg's from code cells rather than from markdown cells, like this: display_jpeg(file="img.jpg", width=400). pandoc's normal behavior then just converts the sized image to \includegraphics[width=..., height=...]{images/...} On Wednesday, July 20, 2022 at 8:57:26 AM UTC-7 Albert Krewinkel wrote: > > Richard Huntsinger writes: > > > Is there a way, perhaps with a lua filter, to capture the > src="image.jpg" width=600> with the sizing > > information [...] > > Lua filter to do this: > > ``` lua > function RawInline (raw) > if raw.format:match 'html' then > return pandoc.utils.blocks_to_inlines( > pandoc.read(raw.text, 'html').blocks > ) > end > end > ``` > > This tries to convert *all* inline HTML code. Modify the `if` condition > in case you want this behavior only for images: > > if raw.text:match '^ > > -- > Albert Krewinkel > GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 > -- 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/bbdf0806-8476-43af-bce7-47a17343e8f4n%40googlegroups.com. ------=_Part_689_258350274.1658435753774 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks, that works well.

Another solution I've come to i= s to just display jpeg's from code cells rather than from markdown cells, l= ike this: display_jpeg(file=3D"img.jpg", width=3D400).  pandoc's norma= l behavior then just converts the sized image to \includegraphics[width=3D.= .., height=3D...]{images/...}



On Wednesday, J= uly 20, 2022 at 8:57:26 AM UTC-7 Albert Krewinkel wrote:

Richard Huntsinger <rhunt= ...@berkeley.edu> writes:

> Is there a way, perhaps with a lua filter, to capture the <img
> src=3D"image.jpg" width=3D600> with the sizing
> information [...]

Lua filter to do this:

``` lua
function RawInline (raw)
if raw.format:match 'html' then
return pandoc.utils.blocks_to_inlines(
pandoc.read(raw.text, 'html').blocks
)
end
end
```

This tries to convert *all* inline HTML code. Modify the `if` condition
in case you want this behavior only for images:

if raw.text:match '^<img' and ...


--=20
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124

--
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/bbdf0806-8476-43af-bce7-47a17343e8f4n%40googlegroups.= com.
------=_Part_689_258350274.1658435753774-- ------=_Part_688_144568873.1658435753774--