From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31936 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ash Wiseth Newsgroups: gmane.text.pandoc Subject: LaTeX reader: Issue when `\label` and `\caption` separated Date: Wed, 28 Dec 2022 08:22:08 -0800 (PST) Message-ID: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_730_37237475.1672244528162" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24304"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBD67NSFCBQILDWVRTUDBUBGGQJLAU-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Dec 28 17:22:13 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oi1-f186.google.com ([209.85.167.186]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pAZC0-00066e-Tt for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 28 Dec 2022 17:22:12 +0100 Original-Received: by mail-oi1-f186.google.com with SMTP id t25-20020a056808159900b0035ecfd3fa78sf2633874oiw.4 for ; Wed, 28 Dec 2022 08:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:message-id:to:from:date:sender:from:to:cc :subject:date:message-id:reply-to; bh=iDNXwnQFSqYQiWkx28uNImtdXPebtwpXhk5S01cNzrE=; b=MZ/rqpp/bYQ37F/lsRLh2YuNVe70FNM5gB5b9BvIaJUi88Bt5o+S4Uk6jLq5A4HcE9 Brl4BpvWB94HiW4LTFMGpFak9325TN8FONJrJQwAPz9Klsd2Sq3fwWI1zaXPWQ2N+Kgr 1o0yxg+2wgyihSWfYdPWTcZoMYU0/lE51Vub3eVfZcQbHoE6rEyRgHw+mjJ+drWWVp6k I902Jcr13P53K3BY+s8BRKE0QnmWYvXb5PoEPpgtXFo13h2y9vXI+57MGTUxYY+pbpoW j/3Uhm6F/MEKT/3zvUn4QCID81M2Rlbb8SdYhxdudPGVoDOJXWvwwrQSUEx8Z7BbqouE 8tTw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:message-id:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=iDNXwnQFSqYQiWkx28uNImtdXPebtwpXhk5S01cNzrE=; b=L1leFR+OXrM683Rrw1aFCkN4HrjMnuhS030l7ix8IKcpw8zHApFLTnNpxtFv0k0sk3 /yVYMrzXaEo1esS9VDMKX0GL1OuRgKKvJ8WBS9Zsc43m7k+rnUnmh27sareyvt4900k4 +yfdX80GYWEAzfXi7y42fDelQuzYDb0cCI7/K2Hhg6TJkoOMo0W2wontGeNZqjyk6G+3 qq+qHirLLaH1V8Pe3U/g+IHzEErQlfC562FLsn5RvFWiM2BiJ0TfOPL6f7pikL6n3psr 1nUu9C2Pp9TLE453oQEiSR/y+aiJyRPAK4p0EDzXsOUkZtJ1DxTwPd5NAi/EbHxI4/Az Y/IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-sender:mime-version:subject:message-id:to:from:date :x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=iDNXwnQFSqYQiWkx28uNImtdXPebtwpXhk5S01cNzrE=; b=jiIXqXtJwQ2h47hwcXD1rSgZ/GohbmL4XYbLQN9JKxQip2JoYoPSeVeIt19E/DrtA6 4dfmNHKRwLHRMqelfTCSZ5d7DhhRyFytQlo1dsOcIwS/cIffdwlb5WCtJMAGEmg+bN5j tFxQkyO3UGus8oGijz0udCq7EzA1VLaxGPMrynT4SuMtOwt7AMVrUtlG2ENjDB1kGDdo kjcIUw2Y9HsqvloDN8pEz8mYWpz/wPlmng3iUsNmBv7GfppLyv0WoElcnEzby2aVaMLU T/RWW4GAqVRScLSLW/E1xODXDdZ7ZXNzNkF3A9U5fR2BYPuSfH/+MFf+4aJnYxAn/oY8 sssA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AFqh2kpU52B2PHFta20kxo2Brx+wOzYVkb70mmEc2LddaeYxImHbx848 XwfKlyo0oRqjfiO5acVMNtk= X-Google-Smtp-Source: AMrXdXtfB6VVXfJpdVReonGI43sfAPaLXAxFDhSLCvg3ETNyVv38gtcJo1Qq0rj6NgmkFA+u3GoWAw== X-Received: by 2002:aca:6085:0:b0:363:240c:bdc7 with SMTP id u127-20020aca6085000000b00363240cbdc7mr865734oib.55.1672244531647; Wed, 28 Dec 2022 08:22:11 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6870:c782:b0:143:408e:349 with SMTP id dy2-20020a056870c78200b00143408e0349ls1274215oab.6.-pod-prod-gmail; Wed, 28 Dec 2022 08:22:09 -0800 (PST) X-Received: by 2002:a05:6870:734:b0:150:20bf:aa29 with SMTP id ea52-20020a056870073400b0015020bfaa29mr348549oab.207.1672244528893; Wed, 28 Dec 2022 08:22:08 -0800 (PST) X-Original-Sender: ash.wiseth-Re5JQEeQqe8AvxtiuMwx3w@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:31936 Archived-At: ------=_Part_730_37237475.1672244528162 Content-Type: multipart/alternative; boundary="----=_Part_731_2041555172.1672244528162" ------=_Part_731_2041555172.1672244528162 Content-Type: text/plain; charset="UTF-8" Hi, I use to Pandoc to convert a large number of LaTeX articles into Markdown, with the original LaTeX articles all from different authors with their own idiosyncratic styles. I've been trying to narrow down some of the conversion issues that have cropped up, and I noticed that the LaTeX reader seems to be very particular about how elements in float (table, figure) environments are ordered. For LaTeX, `\label` normally has to be either inside `\caption` or after `\caption`. As far as I know, however, there is no requirement that `\label` (if appearing after and not inside) appear *immediately* after `\caption`. For example, I can get the following (with `\label` *not* immediately after `\caption`) to compile without any errors or warnings: ``` \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{graphicx} \begin{document} \section{Introduction} The model is shown in Figure \ref{fig:sensPlot}. \begin{figure} \caption{Dependence on Prior Settings} \includegraphics[width=0.7\textwidth]{figures/sensPlot-1.pdf} \label{fig:sensPlot} \end{figure} \end{document} ``` However, when I run Pandoc 2.19.2 to convert this to Markdown, the figure is not processed correctly (the cross-reference appears as [fig:sensPlot] instead of 1, and the caption disappears): ``` # Introduction The model is shown in Figure [\[fig:sensPlot\]](#fig:sensPlot){reference-type="ref" reference="fig:sensPlot"}. ![image](figures/sensPlot-1.pdf){width="70%"} []{#fig:sensPlot label="fig:sensPlot"} ``` Running `pandoc -t native`, it looks like the label is getting separated from the rest of the figure: ``` [ Header 1 ( "introduction" , [] , [] ) [ Str "Introduction" ] , Para [ Str "The" , Space , Str "model" , Space , Str "is" , Space , Str "shown" , Space , Str "in" , Space , Str "Figure" , Space , Link ( "" , [] , [ ( "reference-type" , "ref" ) , ( "reference" , "fig:sensPlot" ) ] ) [ Str "[fig:sensPlot]" ] ( "#fig:sensPlot" , "" ) , Str "." ] , Para [ Image ( "" , [] , [ ( "width" , "70%" ) ] ) [ Str "image" ] ( "figures/sensPlot-1.pdf" , "" ) , SoftBreak , Span ( "fig:sensPlot" , [] , [ ( "label" , "fig:sensPlot" ) ] ) [] ] ] ``` Note that this can be fixed by (1) moving `\label` into `\caption`, (2) switching `\includegraphics` and `\label`, or (3) switching `\caption` and `\includegraphics`. So it definitely seems like an order issue. What am I missing? Is this a bug? Thank you in advance. -- 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/b31d021f-ce8b-4c2e-b2bd-ad9d65a68606n%40googlegroups.com. ------=_Part_731_2041555172.1672244528162 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi,

I use to Pandoc to convert a large number of LaTeX a= rticles into Markdown, with the original LaTeX articles all from different = authors with their own idiosyncratic styles. I've been trying to narrow dow= n some of the conversion issues that have cropped up, and I noticed that th= e LaTeX reader seems to be very particular about how elements in float (tab= le, figure) environments are ordered.

For LaTeX, `= \label` normally has to be either inside `\caption` or after `\caption`. As= far as I know, however, there is no requirement that `\label` (if appearin= g after and not inside) appear immediately after `\caption`. Fo= r example, I can get the following (with `\label` not imme= diately after `\caption`) to compile without any errors or warnings:
<= div>
```
\documentclass{article}
\usepackage[utf= 8]{inputenc}
\usepackage{graphicx}

\begin{document}

\secti= on{Introduction}

 The model is shown in Figure \ref{fig:sensPlo= t}.

    \begin{figure}
        \cap= tion{Dependence on Prior Settings}
        \includeg= raphics[width=3D0.7\textwidth]{figures/sensPlot-1.pdf}
    &nb= sp;   \label{fig:sensPlot}
    \end{figure}

\end{d= ocument}
```

However, when I run Pan= doc 2.19.2 to convert this to Markdown, the figure is not processed correct= ly (the cross-reference appears as [fig:sensPlot] instead of 1, and the cap= tion disappears):

```
# Introduction
=
The model is shown in Figure [\[fig:sensPlot\]](#fig:sensPlot){referenc= e-type=3D"ref" reference=3D"fig:sensPlot"}.

![image](figures/sensPlo= t-1.pdf){width=3D"70%"} []{#fig:sensPlot label=3D"fig:sensPlot"}
<= div>```

Running `pandoc -t native`, it looks like = the label is getting separated from the rest of the figure:

<= /div>
```
[ Header
    1 ( "introduction" , [] ,= [] ) [ Str "Introduction" ]
, Para
    [ Str "The"
&nbs= p;   , Space
    , Str "model"
    , Space    , Str "is"
    , Space
    , Str = "shown"
    , Space
    , Str "in"
  &nbs= p; , Space
    , Str "Figure"
    , Space
&nbs= p;   , Link
        ( ""
     = ;   , []
        , [ ( "reference-type" , "ref"= )
          , ( "reference" , "fig:sensPlot" )=
          ]
        )        [ Str "[fig:sensPlot]" ]
    &nb= sp;   ( "#fig:sensPlot" , "" )
    , Str "."
  &n= bsp; ]
, Para
    [ Image
        ( = "" , [] , [ ( "width" , "70%" ) ] )
        [ Str "i= mage" ]
        ( "figures/sensPlot-1.pdf" , "" )    , SoftBreak
    , Span
      =   ( "fig:sensPlot" , [] , [ ( "label" , "fig:sensPlot" ) ] )
 =       []
    ]
]
```

Note that this can be fixed by (1) moving `\label` into `\= caption`, (2) switching `\includegraphics` and `\label`, or (3) switching `= \caption` and `\includegraphics`. So it definitely seems like an order issu= e.

What am I missing? Is this a bug?
Thank you in advance.

--
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/b31d021f-ce8b-4c2e-b2bd-ad9d65a68606n%40googlegroups.= com.
------=_Part_731_2041555172.1672244528162-- ------=_Part_730_37237475.1672244528162--