Lyx 图和子图中的编号错误

Lyx 图和子图中的编号错误

乳胶来源如下:

  \begin{figure}[h]
    \begin{centering}
    \protect\caption{Accuracies comparision of different methods \label{fig:comparision}}

    \par\end{centering}

    \begin{minipage}[t]{0.96\columnwidth}%
    \noindent \begin{center}
    \begin{minipage}[t]{0.45\columnwidth}%
    \subfloat[\label{fig:comparison1}comparison1]{

    \protect\centering{}\protect\includegraphics[scale=0.25]{Comparision_0}\protect}%
    \end{minipage}\quad{}%
    \begin{minipage}[t]{0.45\columnwidth}%
    \subfloat[\label{fig:comparison2}comparison2]{

    \protect\centering{}\protect\includegraphics[scale=0.25]{Comparision_1}\protect}%
    \end{minipage}
    \par\end{center}%
    \end{minipage}
    \end{figure}

并且,当我引用 时Fig. \ref{fig:comparison},它显示Fig. 7,这是正确的。但是,当我引用Fig. \ref{fig:comparison1}和时Fig. \ref{fig:comparison2},它显示Fig. 8(a)和,Fig. 8(b)这是我期望的Fig. 7(a)Fig. 7(b)

你能帮忙提供一些建议吗?谢谢!

更新:

文件来源lyx如下:

    #LyX 2.1 created this file. For more info see http://www.lyx.org/
    \lyxformat 474
    \begin_document
    \begin_header
    \textclass IEEEtran
    \begin_preamble
    % for subfigures/subtables
    \usepackage[caption=false,font=footnotesize]{subfig}

    \usepackage{algorithm,algpseudocode}

    \usepackage{hyperref}
    \hypersetup{backref,colorlinks,linktocpage=true}

    \usepackage{array}
    \usepackage{booktabs}

    \def\hlinew#1{%
      \noalign{\ifnum0=`}\fi\hrule \@height #1 \futurelet
       \reserved@a\@xhline}

    %\usepackage{subfig}
    %\captionsetup[subfloat]{position=top,farskip=10pt,topadjust=0pt,captionskip=10pt,nearskip=10pt,margin=10pt}
    \end_preamble
    \options journal
    \use_default_options false
    \maintain_unincluded_children false
    \language english
    \language_package default
    \inputencoding default
    \fontencoding global
    \font_roman default
    \font_sans default
    \font_typewriter default
    \font_math auto
    \font_default_family default
    \use_non_tex_fonts false
    \font_sc false
    \font_osf false
    \font_sf_scale 100
    \font_tt_scale 100
    \graphics default
    \default_output_format default
    \output_sync 0
    \bibtex_command bibtex
    \index_command default
    \float_placement tbh
    \paperfontsize default
    \spacing single
    \use_hyperref true
    \pdf_title "Your Title"
    \pdf_author "Your Name"
    \pdf_bookmarks true
    \pdf_bookmarksnumbered true
    \pdf_bookmarksopen true
    \pdf_bookmarksopenlevel 1
    \pdf_breaklinks false
    \pdf_pdfborder true
    \pdf_colorlinks false
    \pdf_backref false
    \pdf_pdfusetitle false
    \pdf_quoted_options "pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false"
    \papersize default
    \use_geometry false
    \use_package amsmath 1
    \use_package amssymb 1
    \use_package cancel 0
    \use_package esint 0
    \use_package mathdots 1
    \use_package mathtools 0
    \use_package mhchem 1
    \use_package stackrel 0
    \use_package stmaryrd 0
    \use_package undertilde 0
    \cite_engine basic
    \cite_engine_type default
    \biblio_style IEEEtran
    \use_bibtopic false
    \use_indices false
    \paperorientation portrait
    \suppress_date false
    \justification true
    \use_refstyle 0
    \index Index
    \shortcut idx
    \color #008000
    \end_index
    \secnumdepth 3
    \tocdepth 3
    \paragraph_separation indent
    \paragraph_indentation default
    \quotes_language english
    \papercolumns 2
    \papersides 1
    \paperpagestyle default
    \tracking_changes false
    \output_changes false
    \html_math_output 0
    \html_css_as_file 0
    \html_be_strict false
    \end_header

    \begin_body

    \begin_layout Standard
    Fig.

    \begin_inset CommandInset ref
    LatexCommand ref
    reference "fig:comparision"

    \end_inset

    .
     As shown in Fig.

    \begin_inset CommandInset ref
    LatexCommand ref
    reference "fig:comparision1"

    \end_inset

    , From the Fig.

    \begin_inset CommandInset ref
    LatexCommand ref
    reference "fig:comparision2"

    \end_inset

    , 
    \end_layout

    \begin_layout Standard
    \begin_inset Float figure
    placement h
    wide false
    sideways false
    status open

    \begin_layout Plain Layout
    \align center
    \begin_inset Caption Standard

    \begin_layout Plain Layout
    Classification accuracies comparision of different methods.

    \begin_inset CommandInset label
    LatexCommand label
    name "fig:comparision"

    \end_inset


    \end_layout

    \end_inset


    \end_layout

    \begin_layout Plain Layout
    \begin_inset Box Frameless
    position "t"
    hor_pos "c"
    has_inner_box 1
    inner_pos "t"
    use_parbox 0
    use_makebox 0
    width "96col%"
    special "none"
    height "1in"
    height_special "totalheight"
    status open

    \begin_layout Plain Layout
    \noindent
    \align center
    \begin_inset Box Frameless
    position "t"
    hor_pos "c"
    has_inner_box 1
    inner_pos "t"
    use_parbox 0
    use_makebox 0
    width "45col%"
    special "none"
    height "1in"
    height_special "totalheight"
    status open

    \begin_layout Plain Layout
    \begin_inset Float figure
    wide false
    sideways false
    status open

    \begin_layout Plain Layout
    \begin_inset Caption Standard

    \begin_layout Plain Layout
    \begin_inset CommandInset label
    LatexCommand label
    name "fig:comparision1"

    \end_inset

    comparison1
    \end_layout

    \end_inset


    \end_layout

    \begin_layout Plain Layout
    \align center
    \begin_inset Graphics
        filename /home/ubuntu/Desktop/img1.eps
        lyxscale 50
        scale 50

    \end_inset


    \end_layout

    \end_inset


    \end_layout

    \end_inset


    \begin_inset space \quad{}
    \end_inset


    \begin_inset Box Frameless
    position "t"
    hor_pos "c"
    has_inner_box 1
    inner_pos "t"
    use_parbox 0
    use_makebox 0
    width "45col%"
    special "none"
    height "1in"
    height_special "totalheight"
    status open

    \begin_layout Plain Layout
    \begin_inset Float figure
    wide false
    sideways false
    status open

    \begin_layout Plain Layout
    \begin_inset Caption Standard

    \begin_layout Plain Layout
    \begin_inset CommandInset label
    LatexCommand label
    name "fig:comparision2"

    \end_inset

    comparison2
    \end_layout

    \end_inset


    \end_layout

    \begin_layout Plain Layout
    \align center
    \begin_inset Graphics
        filename /home/ubuntu/Desktop/img2.eps
        lyxscale 20
        scale 10

    \end_inset


    \end_layout

    \end_inset


    \end_layout

    \end_inset


    \end_layout

    \end_inset


    \end_layout

    \end_inset


    \end_layout

    \end_body
    \end_document

编辑器中的可视化效果lyx如下:

在此处输入图片描述

生成的pdf如下:

在此处输入图片描述

我将其导出lyx到平原Latex如下:

    %% LyX 2.1.3 created this file.  For more info, see http://www.lyx.org/.
    %% Do not edit unless you really know what you are doing.
    \documentclass[twocolumn,english,journal]{IEEEtran}
    \usepackage[T1]{fontenc}
    \usepackage{babel}
    \usepackage{graphicx}
    \usepackage[unicode=true,
     bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=1,
     breaklinks=false,pdfborder={0 0 0},backref=false,colorlinks=false]
     {hyperref}
    \hypersetup{pdftitle={Your Title},
     pdfauthor={Your Name},
     pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false}
    \usepackage{breakurl}

    \makeatletter
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
    % for subfigures/subtables
    \usepackage[caption=false,font=footnotesize]{subfig}

    \usepackage{algorithm,algpseudocode}

    \usepackage{hyperref}
    \hypersetup{backref,colorlinks,linktocpage=true}

    \usepackage{array}
    \usepackage{booktabs}

    \def\hlinew#1{%
      \noalign{\ifnum0=`}\fi\hrule \@height #1 \futurelet
       \reserved@a\@xhline}

    %\usepackage{subfig}
    %\captionsetup[subfloat]{position=top,farskip=10pt,topadjust=0pt,captionskip=10pt,nearskip=10pt,margin=10pt}

    \@ifundefined{showcaptionsetup}{}{%
     \PassOptionsToPackage{caption=false}{subfig}}
    \usepackage{subfig}
    \makeatother

    \begin{document}
    Fig. \ref{fig:comparision}. As shown in Fig. \ref{fig:comparision1},
    From the Fig. \ref{fig:comparision2}, 

    \begin{figure}[h]
    \begin{centering}
    \protect\caption{Classification accuracies comparision of different methods. \label{fig:comparision}}

    \par\end{centering}

    \begin{minipage}[t]{0.96\columnwidth}%
    \noindent \begin{center}
    \begin{minipage}[t]{0.45\columnwidth}%
    \subfloat[\label{fig:comparision1}comparison1]{

    \protect\centering{}\protect\includegraphics[scale=0.5]{/home/ubuntu/Desktop/img1}\protect}%
    \end{minipage}\quad{}%
    \begin{minipage}[t]{0.45\columnwidth}%
    \subfloat[\label{fig:comparision2}comparison2]{

    \protect\centering{}\protect\includegraphics[scale=0.1]{/home/ubuntu/Desktop/img2}\protect}%
    \end{minipage}
    \par\end{center}%
    \end{minipage}
    \end{figure}

    \end{document}

答案1

caption=false如果您想使用字幕就不要说……

编号子图

\documentclass[twocolumn,journal]{IEEEtran}
\usepackage[demo]{graphicx}
\usepackage[font=footnotesize]{subfig}

\begin{document}
  Fig. \ref{fig:comparision}. As shown in Fig. \ref{fig:comparision1},
  From the Fig. \ref{fig:comparision2},

  \begin{figure}[h]
    \centering
     \caption{Classification accuracies comparision of different methods. \label{fig:comparision}}
     \subfloat[\label{fig:comparision1}comparison1]{%
        \includegraphics[scale=0.5]{/home/ubuntu/Desktop/img1}}\thinspace
        \subfloat[\label{fig:comparision2}comparison2]{%
        \includegraphics[scale=0.1]{/home/ubuntu/Desktop/img2}}
  \end{figure}

\end{document}

请注意,我的代码产生了溢出hbox。这可能是因为我使用了demo模式,因为我没有图像。因此,我没有费心去消除这个问题,因为它与当前问题无关。

答案2

如果您将“图 1”标题放在子图下方,对我来说一切都正常!

相关内容