LyX ⇒ Subfigure without number [solved]
Subfigure without number [solved]
Hi, I'm new in the forum. I'm writing my thesis using LyX, v. 2.2.2, and I've got a problem with subfigures.
I'd like to recall the label in the description of the Figure like (a) and (b), but using the cross reference I have 1(a) and 1(b); instead in the text I want exactly 1(a) and 1(b). Like:
(a) graph1 (b) graph2
Figure 1: (a) graph1 and explanation, (b) graph2 and explanation
In fig. 1(a) there's the graph1 about...
I've tried using \subref command, and it works but with an error: "Argument of \caption@ydblarg has an extra }." that I don't understand.
There's some method to overcome this problem? I've searched trough the forum but without result.
I hope I explained myself well.
I'd like to recall the label in the description of the Figure like (a) and (b), but using the cross reference I have 1(a) and 1(b); instead in the text I want exactly 1(a) and 1(b). Like:
(a) graph1 (b) graph2
Figure 1: (a) graph1 and explanation, (b) graph2 and explanation
In fig. 1(a) there's the graph1 about...
I've tried using \subref command, and it works but with an error: "Argument of \caption@ydblarg has an extra }." that I don't understand.
There's some method to overcome this problem? I've searched trough the forum but without result.
I hope I explained myself well.
Last edited by roby92ita on Mon Feb 20, 2017 10:27 am, edited 2 times in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10348
- Joined: Mon Mar 10, 2008 9:44 pm
Subfigure without number [solved]
Hi Roby,
welcome to the forum!
Do you use the
subfigure package, or
subfig? I recommend the latter, since that one is newer.
Maybe take a look at the (here linked) package manual how that works.
Stefan
welcome to the forum!
Do you use the


Maybe take a look at the (here linked) package manual how that works.
Stefan
LaTeX.org admin
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Subfigure without number [solved]
Package subcaption is even better with respect to hyperlink support.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Subfigure without number
Thanks everyone,
the package subcaption is in conflict with the package subfigure that is automatically used by LyX and I don't know how to remove it.
With the package subfig I have the exact problem that i described, maybe it is because I use the insert Image and Insert Label of Lyx instead of using the ERT to load the image?
the package subcaption is in conflict with the package subfigure that is automatically used by LyX and I don't know how to remove it.
With the package subfig I have the exact problem that i described, maybe it is because I use the insert Image and Insert Label of Lyx instead of using the ERT to load the image?
-
- Site Moderator
- Posts: 542
- Joined: Sat Sep 01, 2012 6:38 am
Subfigure without number
Can you post a minimal example where you get the conflict in LyX? If so I can take a look.
Subfigure without number
I made a little file showing what I want to do, hope it help understanding the problem.
The conflict appear when I put in the Preamble \usepackage{caption}, so if you put that in the Preamble of my file I think you'll get the same problem.
Thanks
The conflict appear when I put in the Preamble \usepackage{caption}, so if you put that in the Preamble of my file I think you'll get the same problem.
Thanks
- Attachments
-
- Test.rar
- (14.92 KiB) Downloaded 301 times
-
- Site Moderator
- Posts: 542
- Joined: Sat Sep 01, 2012 6:38 am
Subfigure without number
I know how to disable loading the subfig package in LyX, but then \subfloat is not defined. What do you ideally want the LaTeX output to look like? Perhaps you could post what LyX creates as LaTeX and what you wish it would be. Then I can see if it is possible to have LyX do it.
Subfigure without number [solved]
Thanks, LyX generate:
Instead I want something like this (or at least that make the same output):
Code: Select all
%% LyX 2.2.2 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,twoside,italian]{article}
\usepackage[T1]{fontenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=25mm,bmargin=25mm,lmargin=25mm,rmargin=25mm}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{setspace}
\onehalfspacing
\usepackage[unicode=true,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false]
{hyperref}
\hypersetup{pdftitle={Tesi di Roberto Sciacqua},
pdfauthor={Roberto Sciacqua},
pdfkeywords={Ingegneria, meccanica}}
\makeatletter
\@ifundefined{showcaptionsetup}{}{%
\PassOptionsToPackage{caption=false}{subfig}}
\usepackage{subfig}
\makeatother
\begin{document}
\begin{figure}
\begin{centering}
\subfloat[\label{fig:cat}a cat]{\includegraphics{cat}
}\subfloat[\label{fig:dog}a dog]{\includegraphics{dog}
}
\par\end{centering}
\caption{\label{fig:two-animals}two animals: \subref{fig:cat} a jumping cat,
\subref{fig:dog} a dog}
\end{figure}
In fig. \ref{fig:two-animals} is it possible to see two animals,
in fig. \ref{fig:cat} a jumping cat, in fig. \ref{fig:dog} a dog
playing with a ball.
\end{document}
Code: Select all
\documentclass[12pt,twoside,italian]{article}
\usepackage[T1]{fontenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=25mm,bmargin=25mm,lmargin=25mm,rmargin=25mm}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{setspace}
\onehalfspacing
\usepackage[unicode=true,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false]
{hyperref}
\hypersetup{pdftitle={Tesi di Roberto Sciacqua},
pdfauthor={Roberto Sciacqua},
pdfkeywords={Ingegneria, meccanica}}
\usepackage{subfig}
\begin{document}
\begin{figure}
\centering
\subfloat[][a cat]{\label{cat}\includegraphics{cat}}
\subfloat[][a dog]{\label{dog}\includegraphics{dog}}
\caption[Two animals]{two animals: \subref{cat} a jumping cat,
\subref{dog} a dog}
\label{two-animals}
\end{figure}
In fig. \ref{two-animals} is it possible to see two animals,
in fig. \ref{cat} a jumping cat, in fig. \ref{dog} a dog
playing with a ball.
\end{document}
-
- Site Moderator
- Posts: 542
- Joined: Sat Sep 01, 2012 6:38 am
Subfigure without number
Take a look at the attached .lyx file. I think it gets close to what you want. A few things to note:
1. In Document > Settings > Local Layout, I put "Provides subfig 1". This basically tells LyX "don't worry about automatically loading this, I will do it myself"
2. In the LaTeX Preamble, we load the package.
3. There is some ERT required for e.g. "\subref{cat}", which is not very elegant. This will be improved a bit in LyX version 2.3 (still not close to being released), where you can enter a label directly. With that improvement, we could make a custom inset for "\subref" and no ERT would be required.
1. In Document > Settings > Local Layout, I put "Provides subfig 1". This basically tells LyX "don't worry about automatically loading this, I will do it myself"
2. In the LaTeX Preamble, we load the package.
3. There is some ERT required for e.g. "\subref{cat}", which is not very elegant. This will be improved a bit in LyX version 2.3 (still not close to being released), where you can enter a label directly. With that improvement, we could make a custom inset for "\subref" and no ERT would be required.
- Attachments
-
- dog.jpg (8.14 KiB) Viewed 15109 times
-
- cat.jpg (4.5 KiB) Viewed 15109 times
-
- test.lyx
- (3.9 KiB) Downloaded 449 times
Subfigure without number
It's perfect like this, thanks a lot!