无法在表格中添加数字浮动

无法在表格中添加数字浮动

我正在使用 lyx,所以我不确定如何正确显示 MWE,但我想得到这种输出我希望它也显示图号和标题。 在此处输入图片描述 这是我目前在 lyx 上的情况:

在此处输入图片描述

Box(Minipage)允许图像与图片并排显示(至少在 Lyx 上)。我尝试了几种方法来显示图号和标题,但遇到了很多抱怨:

在此处输入图片描述

上图为框内的一个浮动图形。

在此处输入图片描述

上图仅单独显示了图形浮动。

有人遇到过这种问题吗?非常感谢您的帮助。

编辑:Box(Minipage)允许图像与图像并排显示(至少在 Lyx 上)。但编译后,图像与第一幅图像完全一样,这很好。实际上,真正的问题是添加标题和图号。我试过这个: 在此处输入图片描述

输出如下内容: 在此处输入图片描述

答案1

对于 MWE,将 LyX 源加载到文本编辑器中并将其复制在此处作为代码示例(复制前缩进 4 个空格)。

为了实现所需的功能,请不要使用表格,而是使用带边框的框和水平线来模拟表格。示例: 示例输出

确保边框和水平线的粗细和宽度匹配,并像常规文档一样格式化浮动图像的宽度恒定。这样,当表格长度超过一页时,您也不会遇到麻烦。

示例代码:

#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation skip
\defskip medskip
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\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
\begin_inset Box Boxed
position "t"
hor_pos "c"
has_inner_box 1
inner_pos "t"
use_parbox 0
use_makebox 0
width "30text%"
special "none"
height "4mm"
height_special "none"
thickness "0.5pt"
separation "3pt"
shadowsize "4pt"
framecolor "black"
backgroundcolor "none"
status open

\begin_layout Plain Layout

\series bold
GBot Versions
\end_layout

\end_inset


\begin_inset Box Boxed
position "t"
hor_pos "c"
has_inner_box 1
inner_pos "t"
use_parbox 0
use_makebox 0
width "66text%"
special "none"
height "4mm"
height_special "none"
thickness "0.5pt"
separation "3pt"
shadowsize "4pt"
framecolor "black"
backgroundcolor "none"
status open

\begin_layout Plain Layout

\series bold
Description
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset VSpace -2mm
\end_inset


\begin_inset CommandInset line
LatexCommand rule
offset "0.5ex"
width "100text%"
height "0.5pt"

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Wrap figure
lines 12
placement l
overhang 0in
width "30text%"
status open

\begin_layout Plain Layout
\begin_inset VSpace -4mm
\end_inset


\begin_inset Graphics
    filename /Users/Peter/Pictures/Pauline.jpg
    lyxscale 10
    width 27text%

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption Standard

\begin_layout Plain Layout
Figure 1
\end_layout

\end_inset


\end_layout

\end_inset

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
 eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
 voluptua.
 At vero eos et accusam et justo duo dolores et ea rebum.
 Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor
 sit amet.
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
 eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
 voluptua.
 At vero eos et accusam et justo duo dolores et ea rebum.
 Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor
 sit amet.
\end_layout

\begin_layout Standard
\begin_inset CommandInset line
LatexCommand rule
offset "0.5ex"
width "100text%"
height "0.5pt"

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Wrap figure
lines 12
placement l
overhang 0in
width "30text%"
status open

\begin_layout Plain Layout
\begin_inset VSpace -4mm
\end_inset


\begin_inset Graphics
    filename /Users/Peter/Pictures/Pauline.jpg
    lyxscale 10
    width 27text%

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption Standard

\begin_layout Plain Layout
Figure 2
\end_layout

\end_inset


\end_layout

\end_inset

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
 eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
 voluptua.
 At vero eos et accusam et justo duo dolores et ea rebum.
 Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor
 sit amet.
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
 eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
 voluptua.
 At vero eos et accusam et justo duo dolores et ea rebum.
 Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor
 sit amet.
\end_layout

\begin_layout Standard
\begin_inset CommandInset line
LatexCommand rule
offset "0.5ex"
width "100text%"
height "0.5pt"

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Wrap figure
lines 12
placement l
overhang 0in
width "30text%"
status open

\begin_layout Plain Layout
\begin_inset VSpace -4mm
\end_inset


\begin_inset Graphics
    filename /Users/Peter/Pictures/Pauline.jpg
    lyxscale 10
    width 27text%

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption Standard

\begin_layout Plain Layout
Figure 3
\end_layout

\end_inset


\end_layout

\end_inset

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
 eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
 voluptua.
 At vero eos et accusam et justo duo dolores et ea rebum.
 Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor
 sit amet.
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
 eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
 voluptua.
 At vero eos et accusam et justo duo dolores et ea rebum.
 Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor
 sit amet.
\end_layout

\begin_layout Standard
\begin_inset CommandInset line
LatexCommand rule
offset "0.5ex"
width "100col%"
height "1pt"

\end_inset


\end_layout

\end_body
\end_document

答案2

我猜你喜欢实现这样的目标:

在此处输入图片描述

\documentclass{article}
\usepackage{geometry}
\usepackage[demo]{graphicx}
\usepackage[skip=0.5ex]{caption}

\usepackage{booktabs, tabularx}
\renewcommand\tabularxcolumn[1]{m{#1}}

%-------------------------------- show page layout, only for test
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}             % for dummy text in table

\begin{document}
\noindent
\begin{tabularx}{\linewidth}{@{}
                            >{\hsize=0.3\hsize}X
                            >{\hsize=0.7\hsize}X
                            @{}}
  \toprule
\textbf{GBot Versions}  &   \textbf{Description}    \\
  \midrule
\begin{minipage}{\hsize}
\includegraphics[width=\linewidth]{gbot-1}
\captionof{figure}{}
\end{minipage}          &   \lipsum*[1]          \\
  \midrule
\begin{minipage}{\hsize}
\includegraphics[width=\linewidth]{gbot-2}
\captionof{figure}{}
\end{minipage}          &   \lipsum*[2]          \\
  \bottomrule
\end{tabularx}
\end{document}

我假设这个带有图像的表格短于一页。如果不是这种情况,您应该用 替换tabularxltablex

注意:在实际文档中删除demo选项]aphicx和所有用于显示页面布局的内容以及所有使用的内容 lipsum

相关内容