memoir label and ref subfigures inside bigger image
I have a big image containing several subfigures, each with its own single letter caption already overlayed.
I'd like to reference these subcaptions from the text. As far as I recall something like this was achieavable with subcaption and its phantom commands, but I'm not that sure they covered this particular case.
Is there a way to do it from memoir?
Here's a sample figure to better explain what I'd like to do

It's a single image that I'd prefer not to split. And I'd like to reference the subimages as they were separate figures.
EDIT
Below what I'd do if I could use subcaption, unfortunately as soon as I load it in a document using memoir's own subfigures it messes up with all the caption handling and styling.
So the question remains, is there a way to do phantom subcaptions within memoir?
documentclass{memoir}
usepackage{subcaption}
begin{document}
begin{figure}[t]
centering
includegraphics{figure.png}
begingroup
phantomsubcaption
label{fig:somefiga}
phantomsubcaption
label{fig:somefigb}
phantomsubcaption
label{fig:somefigc}
phantomsubcaption
label{fig:somefigd}
endgroup
caption{some caption}
label{fig:somefig}
end{figure}
noindent Figure~ref{fig:somefig} has four subfigures:
figure~ref{fig:somefiga} is a nice fat rectangle, figureref{fig:somefigb}
looks good too. Figures~ref{fig:somefigc}~and~ref{fig:somefigd} could do
better.
end{document}
captions memoir subfloats
add a comment |
I have a big image containing several subfigures, each with its own single letter caption already overlayed.
I'd like to reference these subcaptions from the text. As far as I recall something like this was achieavable with subcaption and its phantom commands, but I'm not that sure they covered this particular case.
Is there a way to do it from memoir?
Here's a sample figure to better explain what I'd like to do

It's a single image that I'd prefer not to split. And I'd like to reference the subimages as they were separate figures.
EDIT
Below what I'd do if I could use subcaption, unfortunately as soon as I load it in a document using memoir's own subfigures it messes up with all the caption handling and styling.
So the question remains, is there a way to do phantom subcaptions within memoir?
documentclass{memoir}
usepackage{subcaption}
begin{document}
begin{figure}[t]
centering
includegraphics{figure.png}
begingroup
phantomsubcaption
label{fig:somefiga}
phantomsubcaption
label{fig:somefigb}
phantomsubcaption
label{fig:somefigc}
phantomsubcaption
label{fig:somefigd}
endgroup
caption{some caption}
label{fig:somefig}
end{figure}
noindent Figure~ref{fig:somefig} has four subfigures:
figure~ref{fig:somefiga} is a nice fat rectangle, figureref{fig:somefigb}
looks good too. Figures~ref{fig:somefigc}~and~ref{fig:somefigd} could do
better.
end{document}
captions memoir subfloats
Apparently your code is in phantom - mode as well. It's invisible...
– Christian Hupfer
Jan 30 '18 at 11:43
haha, there is no code yet, as I don't have any idea about how to do what I'm asking :-) the code would be just a figure with aincludegraphics{bigimagewithsubfigures.png}
– filippo
Jan 30 '18 at 11:47
@ChristianHupfer see e.g. tex.stackexchange.com/questions/100716/… it's roughly the same issue, there they solve it including the figure twice, the second one hidden, and usingphantomsubcaptionto create references. I'd like to do something like that within memoir
– filippo
Jan 30 '18 at 11:53
@ChristianHupfer added an example figure...
– filippo
Jan 30 '18 at 12:04
1
Related: Put subfigure labels inside figures usingsubfigpackage
– Werner
Feb 1 '18 at 7:02
add a comment |
I have a big image containing several subfigures, each with its own single letter caption already overlayed.
I'd like to reference these subcaptions from the text. As far as I recall something like this was achieavable with subcaption and its phantom commands, but I'm not that sure they covered this particular case.
Is there a way to do it from memoir?
Here's a sample figure to better explain what I'd like to do

It's a single image that I'd prefer not to split. And I'd like to reference the subimages as they were separate figures.
EDIT
Below what I'd do if I could use subcaption, unfortunately as soon as I load it in a document using memoir's own subfigures it messes up with all the caption handling and styling.
So the question remains, is there a way to do phantom subcaptions within memoir?
documentclass{memoir}
usepackage{subcaption}
begin{document}
begin{figure}[t]
centering
includegraphics{figure.png}
begingroup
phantomsubcaption
label{fig:somefiga}
phantomsubcaption
label{fig:somefigb}
phantomsubcaption
label{fig:somefigc}
phantomsubcaption
label{fig:somefigd}
endgroup
caption{some caption}
label{fig:somefig}
end{figure}
noindent Figure~ref{fig:somefig} has four subfigures:
figure~ref{fig:somefiga} is a nice fat rectangle, figureref{fig:somefigb}
looks good too. Figures~ref{fig:somefigc}~and~ref{fig:somefigd} could do
better.
end{document}
captions memoir subfloats
I have a big image containing several subfigures, each with its own single letter caption already overlayed.
I'd like to reference these subcaptions from the text. As far as I recall something like this was achieavable with subcaption and its phantom commands, but I'm not that sure they covered this particular case.
Is there a way to do it from memoir?
Here's a sample figure to better explain what I'd like to do

It's a single image that I'd prefer not to split. And I'd like to reference the subimages as they were separate figures.
EDIT
Below what I'd do if I could use subcaption, unfortunately as soon as I load it in a document using memoir's own subfigures it messes up with all the caption handling and styling.
So the question remains, is there a way to do phantom subcaptions within memoir?
documentclass{memoir}
usepackage{subcaption}
begin{document}
begin{figure}[t]
centering
includegraphics{figure.png}
begingroup
phantomsubcaption
label{fig:somefiga}
phantomsubcaption
label{fig:somefigb}
phantomsubcaption
label{fig:somefigc}
phantomsubcaption
label{fig:somefigd}
endgroup
caption{some caption}
label{fig:somefig}
end{figure}
noindent Figure~ref{fig:somefig} has four subfigures:
figure~ref{fig:somefiga} is a nice fat rectangle, figureref{fig:somefigb}
looks good too. Figures~ref{fig:somefigc}~and~ref{fig:somefigd} could do
better.
end{document}
captions memoir subfloats
captions memoir subfloats
edited Feb 1 '18 at 6:54
asked Jan 30 '18 at 11:42
filippo
351128
351128
Apparently your code is in phantom - mode as well. It's invisible...
– Christian Hupfer
Jan 30 '18 at 11:43
haha, there is no code yet, as I don't have any idea about how to do what I'm asking :-) the code would be just a figure with aincludegraphics{bigimagewithsubfigures.png}
– filippo
Jan 30 '18 at 11:47
@ChristianHupfer see e.g. tex.stackexchange.com/questions/100716/… it's roughly the same issue, there they solve it including the figure twice, the second one hidden, and usingphantomsubcaptionto create references. I'd like to do something like that within memoir
– filippo
Jan 30 '18 at 11:53
@ChristianHupfer added an example figure...
– filippo
Jan 30 '18 at 12:04
1
Related: Put subfigure labels inside figures usingsubfigpackage
– Werner
Feb 1 '18 at 7:02
add a comment |
Apparently your code is in phantom - mode as well. It's invisible...
– Christian Hupfer
Jan 30 '18 at 11:43
haha, there is no code yet, as I don't have any idea about how to do what I'm asking :-) the code would be just a figure with aincludegraphics{bigimagewithsubfigures.png}
– filippo
Jan 30 '18 at 11:47
@ChristianHupfer see e.g. tex.stackexchange.com/questions/100716/… it's roughly the same issue, there they solve it including the figure twice, the second one hidden, and usingphantomsubcaptionto create references. I'd like to do something like that within memoir
– filippo
Jan 30 '18 at 11:53
@ChristianHupfer added an example figure...
– filippo
Jan 30 '18 at 12:04
1
Related: Put subfigure labels inside figures usingsubfigpackage
– Werner
Feb 1 '18 at 7:02
Apparently your code is in phantom - mode as well. It's invisible...
– Christian Hupfer
Jan 30 '18 at 11:43
Apparently your code is in phantom - mode as well. It's invisible...
– Christian Hupfer
Jan 30 '18 at 11:43
haha, there is no code yet, as I don't have any idea about how to do what I'm asking :-) the code would be just a figure with a
includegraphics{bigimagewithsubfigures.png}– filippo
Jan 30 '18 at 11:47
haha, there is no code yet, as I don't have any idea about how to do what I'm asking :-) the code would be just a figure with a
includegraphics{bigimagewithsubfigures.png}– filippo
Jan 30 '18 at 11:47
@ChristianHupfer see e.g. tex.stackexchange.com/questions/100716/… it's roughly the same issue, there they solve it including the figure twice, the second one hidden, and using
phantomsubcaption to create references. I'd like to do something like that within memoir– filippo
Jan 30 '18 at 11:53
@ChristianHupfer see e.g. tex.stackexchange.com/questions/100716/… it's roughly the same issue, there they solve it including the figure twice, the second one hidden, and using
phantomsubcaption to create references. I'd like to do something like that within memoir– filippo
Jan 30 '18 at 11:53
@ChristianHupfer added an example figure...
– filippo
Jan 30 '18 at 12:04
@ChristianHupfer added an example figure...
– filippo
Jan 30 '18 at 12:04
1
1
Related: Put subfigure labels inside figures using
subfig package– Werner
Feb 1 '18 at 7:02
Related: Put subfigure labels inside figures using
subfig package– Werner
Feb 1 '18 at 7:02
add a comment |
1 Answer
1
active
oldest
votes
AFAIU, this cannot be achieved with just native Memoir macros. My own quick-and-dirty (absolutely no warranty) solution was to introduce slightly modified versions of the original native macros (side-by-side diff):
documentclass[a4paper,14pt]{memoir}
usepackage{graphicx}
usepackage{hyperref}
hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}
usepackage[all]{hypcap}
% =============== defining the subcaptionphantom ===================================
makeatletter
% begin{macro}{subcaptionphantom}
% cs{subcaptionphantom}oarg{list-entry}marg{caption} is a hidden
% non-printed subcaption. Designed for the case if "(a)", "(b)" are
% already embedded in the figure itself.
% Roughtly equivalent to cs{phantomsubcaption} from the Lpack{subcaption} package.
%
% begin{macrocode}
newcommand{subcaptionphantom}{%
bgroup
letlabel=memsub@label
ifdonemaincaptionelse
advancecsname c@@captypeendcsname@ne
fi
refstepcounter{sub@captype}@contkeep
@ifnextchar [%
{@memsubcapphantom{sub@captype}}%
{@memsubcapphantom{sub@captype}[@empty]}}
% end{macrocode}
% end{macro}
% begin{macro}{@memsubcapphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{memsubcap}, adapted
% for use in cs{subcaptionphantom}.
% begin{macrocode}
longdef@memsubcapphantom#1[#2]#3{%
@tempdima=hsize
vskipsubfloatcapskip
ifx @empty #2
@memsubcaptionphantom{#1}{#3}{#3}%
else
@memsubcaptionphantom{#1}{#2}{#3}%
fi
vskipsubfloatcapskip
egroup}
% end{macrocode}
% end{macro}
%
%
% begin{macro}{@memsubcaptionphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{memsubcaption}, adapted
% for use in cs{memsubcapphantom}.
% begin{macrocode}
newcommand{@memsubcaptionphantom}[3]{%
ifx relax#2relax else
bgroup
letlabel@gobble
letprotectstring
def@memsubcaplabel{@nameuse{@@the#1}}%
xdef@memsubfigcaptionlist{%
@memsubfigcaptionlist,%
{protectnumberline{@memsubcaplabel}noexpand{ignorespaces #2}}}%
egroup
fi
@makesubfloatcaptionphantom{@nameuse{@the#1}}{#3}%
}
% end{macrocode}
% end{macro}
% begin{macro}{@makesubfloatcaptionphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{makesubfloatcaption}, adapted
% for use in cs{memsubcaptionphantom}.
% begin{macrocode}
newcommand{@makesubfloatcaptionphantom}[2]{%
setbox@tempboxahbox{%
@subcapsize
{@subcaplabelfont phantom{#1}}{@subcapfontignorespaces #2}unskip}%
@tempdimb=-subfloatcapmargin
multiply@tempdimbtw@
advance@tempdimb@tempdima
hb@xt@@tempdima{%
hss
ifdim wd@tempboxa >@tempdimb
phantom{memsubfig@caption{#1}{#2}}%
else
if@shortsubcap
memsubfig@caption{#1}{#2}%
else
box@tempboxa
fi
fi
hss}}
% end{macrocode}
% end{macro}
makeatother
% ===================================================================================
newsubfloat{figure} % allows to use "subbottom"
begin{document}
begin{figure}
centering
hfill%
begin{minipage}[b][b]{0.6linewidth}
centering
subcaptionphantom{label{sf:1}}
subcaptionphantom{label{sf:2}}
framebox[linewidth]{textit{subfigure with embedded (a)}}
framebox[linewidth]{textit{subfigure with embedded (b)}}
end{minipage}
hfill%
begin{minipage}{0.3linewidth}
centering
subbottom[regular subfigure label{sf:3}]%
{includegraphics[width=0.7linewidth]{example-image}}
end{minipage}
caption{Figure with three subfigureslabel{fig:1}}
end{figure}
Example refs:newline
Full fig: ref{fig:1}. newline
Sub1: subcaptionref{sf:1}, same as ref{sf:1} (the hidden caption). newline
Sub2: subcaptionref{sf:2}, same as ref{sf:2} (the hidden caption). newline
Sub3: subcaptionref{sf:3}, same as ref{sf:3}. newline
clearpage
This text is here to add more space for scrolling.
end{document}
Same in Overleaf.

add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f412838%2fmemoir-label-and-ref-subfigures-inside-bigger-image%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
AFAIU, this cannot be achieved with just native Memoir macros. My own quick-and-dirty (absolutely no warranty) solution was to introduce slightly modified versions of the original native macros (side-by-side diff):
documentclass[a4paper,14pt]{memoir}
usepackage{graphicx}
usepackage{hyperref}
hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}
usepackage[all]{hypcap}
% =============== defining the subcaptionphantom ===================================
makeatletter
% begin{macro}{subcaptionphantom}
% cs{subcaptionphantom}oarg{list-entry}marg{caption} is a hidden
% non-printed subcaption. Designed for the case if "(a)", "(b)" are
% already embedded in the figure itself.
% Roughtly equivalent to cs{phantomsubcaption} from the Lpack{subcaption} package.
%
% begin{macrocode}
newcommand{subcaptionphantom}{%
bgroup
letlabel=memsub@label
ifdonemaincaptionelse
advancecsname c@@captypeendcsname@ne
fi
refstepcounter{sub@captype}@contkeep
@ifnextchar [%
{@memsubcapphantom{sub@captype}}%
{@memsubcapphantom{sub@captype}[@empty]}}
% end{macrocode}
% end{macro}
% begin{macro}{@memsubcapphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{memsubcap}, adapted
% for use in cs{subcaptionphantom}.
% begin{macrocode}
longdef@memsubcapphantom#1[#2]#3{%
@tempdima=hsize
vskipsubfloatcapskip
ifx @empty #2
@memsubcaptionphantom{#1}{#3}{#3}%
else
@memsubcaptionphantom{#1}{#2}{#3}%
fi
vskipsubfloatcapskip
egroup}
% end{macrocode}
% end{macro}
%
%
% begin{macro}{@memsubcaptionphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{memsubcaption}, adapted
% for use in cs{memsubcapphantom}.
% begin{macrocode}
newcommand{@memsubcaptionphantom}[3]{%
ifx relax#2relax else
bgroup
letlabel@gobble
letprotectstring
def@memsubcaplabel{@nameuse{@@the#1}}%
xdef@memsubfigcaptionlist{%
@memsubfigcaptionlist,%
{protectnumberline{@memsubcaplabel}noexpand{ignorespaces #2}}}%
egroup
fi
@makesubfloatcaptionphantom{@nameuse{@the#1}}{#3}%
}
% end{macrocode}
% end{macro}
% begin{macro}{@makesubfloatcaptionphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{makesubfloatcaption}, adapted
% for use in cs{memsubcaptionphantom}.
% begin{macrocode}
newcommand{@makesubfloatcaptionphantom}[2]{%
setbox@tempboxahbox{%
@subcapsize
{@subcaplabelfont phantom{#1}}{@subcapfontignorespaces #2}unskip}%
@tempdimb=-subfloatcapmargin
multiply@tempdimbtw@
advance@tempdimb@tempdima
hb@xt@@tempdima{%
hss
ifdim wd@tempboxa >@tempdimb
phantom{memsubfig@caption{#1}{#2}}%
else
if@shortsubcap
memsubfig@caption{#1}{#2}%
else
box@tempboxa
fi
fi
hss}}
% end{macrocode}
% end{macro}
makeatother
% ===================================================================================
newsubfloat{figure} % allows to use "subbottom"
begin{document}
begin{figure}
centering
hfill%
begin{minipage}[b][b]{0.6linewidth}
centering
subcaptionphantom{label{sf:1}}
subcaptionphantom{label{sf:2}}
framebox[linewidth]{textit{subfigure with embedded (a)}}
framebox[linewidth]{textit{subfigure with embedded (b)}}
end{minipage}
hfill%
begin{minipage}{0.3linewidth}
centering
subbottom[regular subfigure label{sf:3}]%
{includegraphics[width=0.7linewidth]{example-image}}
end{minipage}
caption{Figure with three subfigureslabel{fig:1}}
end{figure}
Example refs:newline
Full fig: ref{fig:1}. newline
Sub1: subcaptionref{sf:1}, same as ref{sf:1} (the hidden caption). newline
Sub2: subcaptionref{sf:2}, same as ref{sf:2} (the hidden caption). newline
Sub3: subcaptionref{sf:3}, same as ref{sf:3}. newline
clearpage
This text is here to add more space for scrolling.
end{document}
Same in Overleaf.

add a comment |
AFAIU, this cannot be achieved with just native Memoir macros. My own quick-and-dirty (absolutely no warranty) solution was to introduce slightly modified versions of the original native macros (side-by-side diff):
documentclass[a4paper,14pt]{memoir}
usepackage{graphicx}
usepackage{hyperref}
hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}
usepackage[all]{hypcap}
% =============== defining the subcaptionphantom ===================================
makeatletter
% begin{macro}{subcaptionphantom}
% cs{subcaptionphantom}oarg{list-entry}marg{caption} is a hidden
% non-printed subcaption. Designed for the case if "(a)", "(b)" are
% already embedded in the figure itself.
% Roughtly equivalent to cs{phantomsubcaption} from the Lpack{subcaption} package.
%
% begin{macrocode}
newcommand{subcaptionphantom}{%
bgroup
letlabel=memsub@label
ifdonemaincaptionelse
advancecsname c@@captypeendcsname@ne
fi
refstepcounter{sub@captype}@contkeep
@ifnextchar [%
{@memsubcapphantom{sub@captype}}%
{@memsubcapphantom{sub@captype}[@empty]}}
% end{macrocode}
% end{macro}
% begin{macro}{@memsubcapphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{memsubcap}, adapted
% for use in cs{subcaptionphantom}.
% begin{macrocode}
longdef@memsubcapphantom#1[#2]#3{%
@tempdima=hsize
vskipsubfloatcapskip
ifx @empty #2
@memsubcaptionphantom{#1}{#3}{#3}%
else
@memsubcaptionphantom{#1}{#2}{#3}%
fi
vskipsubfloatcapskip
egroup}
% end{macrocode}
% end{macro}
%
%
% begin{macro}{@memsubcaptionphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{memsubcaption}, adapted
% for use in cs{memsubcapphantom}.
% begin{macrocode}
newcommand{@memsubcaptionphantom}[3]{%
ifx relax#2relax else
bgroup
letlabel@gobble
letprotectstring
def@memsubcaplabel{@nameuse{@@the#1}}%
xdef@memsubfigcaptionlist{%
@memsubfigcaptionlist,%
{protectnumberline{@memsubcaplabel}noexpand{ignorespaces #2}}}%
egroup
fi
@makesubfloatcaptionphantom{@nameuse{@the#1}}{#3}%
}
% end{macrocode}
% end{macro}
% begin{macro}{@makesubfloatcaptionphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{makesubfloatcaption}, adapted
% for use in cs{memsubcaptionphantom}.
% begin{macrocode}
newcommand{@makesubfloatcaptionphantom}[2]{%
setbox@tempboxahbox{%
@subcapsize
{@subcaplabelfont phantom{#1}}{@subcapfontignorespaces #2}unskip}%
@tempdimb=-subfloatcapmargin
multiply@tempdimbtw@
advance@tempdimb@tempdima
hb@xt@@tempdima{%
hss
ifdim wd@tempboxa >@tempdimb
phantom{memsubfig@caption{#1}{#2}}%
else
if@shortsubcap
memsubfig@caption{#1}{#2}%
else
box@tempboxa
fi
fi
hss}}
% end{macrocode}
% end{macro}
makeatother
% ===================================================================================
newsubfloat{figure} % allows to use "subbottom"
begin{document}
begin{figure}
centering
hfill%
begin{minipage}[b][b]{0.6linewidth}
centering
subcaptionphantom{label{sf:1}}
subcaptionphantom{label{sf:2}}
framebox[linewidth]{textit{subfigure with embedded (a)}}
framebox[linewidth]{textit{subfigure with embedded (b)}}
end{minipage}
hfill%
begin{minipage}{0.3linewidth}
centering
subbottom[regular subfigure label{sf:3}]%
{includegraphics[width=0.7linewidth]{example-image}}
end{minipage}
caption{Figure with three subfigureslabel{fig:1}}
end{figure}
Example refs:newline
Full fig: ref{fig:1}. newline
Sub1: subcaptionref{sf:1}, same as ref{sf:1} (the hidden caption). newline
Sub2: subcaptionref{sf:2}, same as ref{sf:2} (the hidden caption). newline
Sub3: subcaptionref{sf:3}, same as ref{sf:3}. newline
clearpage
This text is here to add more space for scrolling.
end{document}
Same in Overleaf.

add a comment |
AFAIU, this cannot be achieved with just native Memoir macros. My own quick-and-dirty (absolutely no warranty) solution was to introduce slightly modified versions of the original native macros (side-by-side diff):
documentclass[a4paper,14pt]{memoir}
usepackage{graphicx}
usepackage{hyperref}
hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}
usepackage[all]{hypcap}
% =============== defining the subcaptionphantom ===================================
makeatletter
% begin{macro}{subcaptionphantom}
% cs{subcaptionphantom}oarg{list-entry}marg{caption} is a hidden
% non-printed subcaption. Designed for the case if "(a)", "(b)" are
% already embedded in the figure itself.
% Roughtly equivalent to cs{phantomsubcaption} from the Lpack{subcaption} package.
%
% begin{macrocode}
newcommand{subcaptionphantom}{%
bgroup
letlabel=memsub@label
ifdonemaincaptionelse
advancecsname c@@captypeendcsname@ne
fi
refstepcounter{sub@captype}@contkeep
@ifnextchar [%
{@memsubcapphantom{sub@captype}}%
{@memsubcapphantom{sub@captype}[@empty]}}
% end{macrocode}
% end{macro}
% begin{macro}{@memsubcapphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{memsubcap}, adapted
% for use in cs{subcaptionphantom}.
% begin{macrocode}
longdef@memsubcapphantom#1[#2]#3{%
@tempdima=hsize
vskipsubfloatcapskip
ifx @empty #2
@memsubcaptionphantom{#1}{#3}{#3}%
else
@memsubcaptionphantom{#1}{#2}{#3}%
fi
vskipsubfloatcapskip
egroup}
% end{macrocode}
% end{macro}
%
%
% begin{macro}{@memsubcaptionphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{memsubcaption}, adapted
% for use in cs{memsubcapphantom}.
% begin{macrocode}
newcommand{@memsubcaptionphantom}[3]{%
ifx relax#2relax else
bgroup
letlabel@gobble
letprotectstring
def@memsubcaplabel{@nameuse{@@the#1}}%
xdef@memsubfigcaptionlist{%
@memsubfigcaptionlist,%
{protectnumberline{@memsubcaplabel}noexpand{ignorespaces #2}}}%
egroup
fi
@makesubfloatcaptionphantom{@nameuse{@the#1}}{#3}%
}
% end{macrocode}
% end{macro}
% begin{macro}{@makesubfloatcaptionphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{makesubfloatcaption}, adapted
% for use in cs{memsubcaptionphantom}.
% begin{macrocode}
newcommand{@makesubfloatcaptionphantom}[2]{%
setbox@tempboxahbox{%
@subcapsize
{@subcaplabelfont phantom{#1}}{@subcapfontignorespaces #2}unskip}%
@tempdimb=-subfloatcapmargin
multiply@tempdimbtw@
advance@tempdimb@tempdima
hb@xt@@tempdima{%
hss
ifdim wd@tempboxa >@tempdimb
phantom{memsubfig@caption{#1}{#2}}%
else
if@shortsubcap
memsubfig@caption{#1}{#2}%
else
box@tempboxa
fi
fi
hss}}
% end{macrocode}
% end{macro}
makeatother
% ===================================================================================
newsubfloat{figure} % allows to use "subbottom"
begin{document}
begin{figure}
centering
hfill%
begin{minipage}[b][b]{0.6linewidth}
centering
subcaptionphantom{label{sf:1}}
subcaptionphantom{label{sf:2}}
framebox[linewidth]{textit{subfigure with embedded (a)}}
framebox[linewidth]{textit{subfigure with embedded (b)}}
end{minipage}
hfill%
begin{minipage}{0.3linewidth}
centering
subbottom[regular subfigure label{sf:3}]%
{includegraphics[width=0.7linewidth]{example-image}}
end{minipage}
caption{Figure with three subfigureslabel{fig:1}}
end{figure}
Example refs:newline
Full fig: ref{fig:1}. newline
Sub1: subcaptionref{sf:1}, same as ref{sf:1} (the hidden caption). newline
Sub2: subcaptionref{sf:2}, same as ref{sf:2} (the hidden caption). newline
Sub3: subcaptionref{sf:3}, same as ref{sf:3}. newline
clearpage
This text is here to add more space for scrolling.
end{document}
Same in Overleaf.

AFAIU, this cannot be achieved with just native Memoir macros. My own quick-and-dirty (absolutely no warranty) solution was to introduce slightly modified versions of the original native macros (side-by-side diff):
documentclass[a4paper,14pt]{memoir}
usepackage{graphicx}
usepackage{hyperref}
hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}
usepackage[all]{hypcap}
% =============== defining the subcaptionphantom ===================================
makeatletter
% begin{macro}{subcaptionphantom}
% cs{subcaptionphantom}oarg{list-entry}marg{caption} is a hidden
% non-printed subcaption. Designed for the case if "(a)", "(b)" are
% already embedded in the figure itself.
% Roughtly equivalent to cs{phantomsubcaption} from the Lpack{subcaption} package.
%
% begin{macrocode}
newcommand{subcaptionphantom}{%
bgroup
letlabel=memsub@label
ifdonemaincaptionelse
advancecsname c@@captypeendcsname@ne
fi
refstepcounter{sub@captype}@contkeep
@ifnextchar [%
{@memsubcapphantom{sub@captype}}%
{@memsubcapphantom{sub@captype}[@empty]}}
% end{macrocode}
% end{macro}
% begin{macro}{@memsubcapphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{memsubcap}, adapted
% for use in cs{subcaptionphantom}.
% begin{macrocode}
longdef@memsubcapphantom#1[#2]#3{%
@tempdima=hsize
vskipsubfloatcapskip
ifx @empty #2
@memsubcaptionphantom{#1}{#3}{#3}%
else
@memsubcaptionphantom{#1}{#2}{#3}%
fi
vskipsubfloatcapskip
egroup}
% end{macrocode}
% end{macro}
%
%
% begin{macro}{@memsubcaptionphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{memsubcaption}, adapted
% for use in cs{memsubcapphantom}.
% begin{macrocode}
newcommand{@memsubcaptionphantom}[3]{%
ifx relax#2relax else
bgroup
letlabel@gobble
letprotectstring
def@memsubcaplabel{@nameuse{@@the#1}}%
xdef@memsubfigcaptionlist{%
@memsubfigcaptionlist,%
{protectnumberline{@memsubcaplabel}noexpand{ignorespaces #2}}}%
egroup
fi
@makesubfloatcaptionphantom{@nameuse{@the#1}}{#3}%
}
% end{macrocode}
% end{macro}
% begin{macro}{@makesubfloatcaptionphantom}
% Quick-and-dirty analog of Lpack{memoir} cs{makesubfloatcaption}, adapted
% for use in cs{memsubcaptionphantom}.
% begin{macrocode}
newcommand{@makesubfloatcaptionphantom}[2]{%
setbox@tempboxahbox{%
@subcapsize
{@subcaplabelfont phantom{#1}}{@subcapfontignorespaces #2}unskip}%
@tempdimb=-subfloatcapmargin
multiply@tempdimbtw@
advance@tempdimb@tempdima
hb@xt@@tempdima{%
hss
ifdim wd@tempboxa >@tempdimb
phantom{memsubfig@caption{#1}{#2}}%
else
if@shortsubcap
memsubfig@caption{#1}{#2}%
else
box@tempboxa
fi
fi
hss}}
% end{macrocode}
% end{macro}
makeatother
% ===================================================================================
newsubfloat{figure} % allows to use "subbottom"
begin{document}
begin{figure}
centering
hfill%
begin{minipage}[b][b]{0.6linewidth}
centering
subcaptionphantom{label{sf:1}}
subcaptionphantom{label{sf:2}}
framebox[linewidth]{textit{subfigure with embedded (a)}}
framebox[linewidth]{textit{subfigure with embedded (b)}}
end{minipage}
hfill%
begin{minipage}{0.3linewidth}
centering
subbottom[regular subfigure label{sf:3}]%
{includegraphics[width=0.7linewidth]{example-image}}
end{minipage}
caption{Figure with three subfigureslabel{fig:1}}
end{figure}
Example refs:newline
Full fig: ref{fig:1}. newline
Sub1: subcaptionref{sf:1}, same as ref{sf:1} (the hidden caption). newline
Sub2: subcaptionref{sf:2}, same as ref{sf:2} (the hidden caption). newline
Sub3: subcaptionref{sf:3}, same as ref{sf:3}. newline
clearpage
This text is here to add more space for scrolling.
end{document}
Same in Overleaf.

edited 1 hour ago
answered 1 hour ago
Igor
1287
1287
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f412838%2fmemoir-label-and-ref-subfigures-inside-bigger-image%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Apparently your code is in phantom - mode as well. It's invisible...
– Christian Hupfer
Jan 30 '18 at 11:43
haha, there is no code yet, as I don't have any idea about how to do what I'm asking :-) the code would be just a figure with a
includegraphics{bigimagewithsubfigures.png}– filippo
Jan 30 '18 at 11:47
@ChristianHupfer see e.g. tex.stackexchange.com/questions/100716/… it's roughly the same issue, there they solve it including the figure twice, the second one hidden, and using
phantomsubcaptionto create references. I'd like to do something like that within memoir– filippo
Jan 30 '18 at 11:53
@ChristianHupfer added an example figure...
– filippo
Jan 30 '18 at 12:04
1
Related: Put subfigure labels inside figures using
subfigpackage– Werner
Feb 1 '18 at 7:02