3

I'm using lyx so I'm not sure how to properly show a MWE but here goes. I want to get this kind of output BUT I want it to show figure number and caption as well. enter image description here This is how I have it currently on lyx:

enter image description here

The Box(Minipage) allows the image to appear side by side with the image (at least on Lyx). I tried a couple of ways to get the figure number and caption to appear but met with a lot of complaints:

enter image description here

Figure above with a figure float inside the Box.

enter image description here

Figure above with only figure float alone.

Has anyone came across this kind of problem? Your help is very much appreciated.

EDIT: The Box(Minipage) allows the image to appear side by side with the image (at least on Lyx). But after compilation,the image appeared exactly as the first image which is fine. Actually, the real issue is to add the caption and figure number. I tried this: enter image description here

Which outputs this: enter image description here

19
  • 4
    Welcome to TeX SX! If the graphic file is in a table, it can't be a float. The code should just be something like \includegraphics{filename}. – Bernard Dec 27 '17 at 20:28
  • 3
    @zaraku27: Try \captionof{figure}{asdadasd} (you need either the capt-of package or the caption package) – user31729 Dec 27 '17 at 21:52
  • 2
    @zaraku27: Well, as long as you don't show a compilable document, there's not much help here – user31729 Dec 27 '17 at 22:19
  • 1
    @zaraku27: I don't use LyX. You learn nothing about LaTeX by using it, in fact – user31729 Dec 28 '17 at 9:07
  • 2
    How-to make a LyX MWE (in LaTeX code) : (1) Reduce the document to only the problematic part . (2) View > Source Pane > Complete source > Copy & Paste. – Fran Dec 28 '17 at 21:45
1

For a MWE, load the LyX source into a text editor and copy it here as a code example (indent by 4 spaces before copying it).

In order to achieve the desired functionality, don't use tables but fake them with bordered boxes and horizontal lines. Example: Sample output

Make sure that the border and horizontal line thicknesses and widths match up and format all like a regular document with constant width of the floating images. This way you don't hit a wall when the table is longer than one page, too.

Sample code:

#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
0

i guessing that you like achieve something like this:

enter image description here

\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}

i assume that this table with images is shorter than one page. in case that this is not a case, you should replace tabularx package with ltablex.

note: in real document remove demo option from ]aphicx and all stuff for showing page layout as well as all use of lipsum.

3
  • The OP uses LyX. – Werner Dec 28 '17 at 21:35
  • @Zarko: Thanks. Yup. That's the output that I want but would be nice if your solution is in Lyx format. I'm still scratching my head how to make use of your solution. – zaraku27 Dec 28 '17 at 21:49
  • @Werner, is this important? i don't know lyx, but this should work in it too. if not, than op should wait on better solution (then i can only conclude, that lyx has very little common with latex). – Zarko Dec 28 '17 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.