LyX ⇒ Subfigure without number [solved]
Subfigure without number [solved]
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.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Stefan Kottwitz
- Site Admin
- Posts: 10397
- Joined: Mon Mar 10, 2008 9:44 pm
Subfigure without number [solved]
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
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Subfigure without number [solved]
Subfigure without number
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?
-
scottkosty
- Site Moderator
- Posts: 542
- Joined: Sat Sep 01, 2012 6:38 am
Subfigure without number
Subfigure without number
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 316 times
-
scottkosty
- Site Moderator
- Posts: 542
- Joined: Sat Sep 01, 2012 6:38 am
Subfigure without number
Subfigure without number [solved]
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}-
scottkosty
- Site Moderator
- Posts: 542
- Joined: Sat Sep 01, 2012 6:38 am
Subfigure without number
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 16179 times
-
- cat.jpg (4.5 KiB) Viewed 16179 times
-
- test.lyx
- (3.9 KiB) Downloaded 468 times