While I don't regret switching a thesis to KOMA script, I do (sometimes) regret stopping using the caption
package even though it works fine with scrreprt
! I need a solution that won't require using the caption
package. Here is an MWE:
\documentclass{scrreprt}
\KOMAoption{captions}{tableheading, figuresignature}
\usepackage{graphicx}
\usepackage{lipsum}
\makeatletter
\newcommand\NOcaption[1]{%
\renewcommand*{\figureformat}{}
\renewcommand*{\tableformat}{}
\renewcommand*{\captionformat}{}
\addtocounter{\@captype}{-1}
\caption{#1}}
\makeatother
\begin{document}
\listoffigures
\listoftables
\clearpage
\lipsum[1]
\begin{table}[ht]
\centering
\NOcaption{}
\begin{tabular}{c}
A table
\end{tabular}
\end{table}
\lipsum[2]
\begin{figure}[ht]
\centering
A figure
\NOcaption{}
\end{figure}
\lipsum[3]
\end{document}
Using the above combination, the caption does not appear in the main text, however, there's an entry for the figure/table in the lists.
Edit:
The whole point of defining a new command NOcaption
is to save my self from renewing figureformat
, tableformat
and captionformat
at every table or figure. It was taken from this question. I can see why this is a bit confusing because the correct definition should be:
\makeatletter
\newcommand\NOcaption{% %NO arguments any more.
\renewcommand*{\figureformat}{}
\renewcommand*{\tableformat}{}
\renewcommand*{\captionformat}{}
\addtocounter{\@captype}{-1}
\caption{}}
\makeatother
Then I would just use \NOcaption
instead of \NOcaption{}
Putting things in terms of the caption package, I'm looking for an equivalent of list=no
in KOMA scrpt, see this answer.
Edit: I should have put this in the MWE, I'm also using hyperref
and hypcap
. This is why I'm trying to put an 'empty' caption in the first place as hypcap
gives an error if no caption was found.
Package hypcap Error: You have forgotten to use \caption.
\usepackage{hyperref}
\usepackage[all]{hypercap}
\caption
inside\Nocaption
but put the text inside a\parbox
or whatever.\caption
?\newcommand\NOcaption{\begingroup\def\addtocontents##1##2{}\expandafter\endgroup\caption}
(not guaranteed).\parbox{\linewidth}{#1}
(or something else) instead of\caption{#1}
?