0

A KOMAscript based template a few years old needs some updates because versions and compatibilities have changed (eg. filecontents not requiring an extra package anymore, etc.). In this process I tried to get rid of warnings and/or packages for which there is already functionality in KOMAscript. float and caption are the last packages to resist.

The requirements are

  1. wanting to get rid of float [H] (the only reason the float package is used)
  2. have captions aligned to the left below tables / figures
  3. optionally there might be some remark about the table / figure origin including a \cite between table/figure and caption
  4. links from ListOf should go to the table/figure no the caption itself to be useful

Captions with caption/float

Here's the code for the caption/float based version:

\documentclass{scrartcl}

\setkomafont{captionlabel}{\bfseries}

\usepackage{lipsum}

\usepackage{float} \usepackage[ singlelinecheck=false, ]{caption}

\usepackage[ backend=biber, citestyle=authoryear, ]{biblatex} \addbibresource{\jobname.bib}

\begin{filecontents}{\jobname.bib} @Book{Mittal2013, title = {Netcentric System of Systems Engineering with DEVS Unified Process}, author = {Mittal, Saurabh and Martín, José L. R.}, publisher = {CRC Press}, year = {2013}, series = {System of systems engineering}, isbn = {978-1-4398-2707-9}, } \end{filecontents}

\usepackage[ hidelinks, breaklinks=true ]{hyperref} \hypersetup{ bookmarksopen=true, bookmarksopenlevel=3, bookmarksnumbered=true, linktoc=all, }

\begin{document} \listoftables \newpage

\lipsum[1-4] \begin{table}[H] \begin{center} \begin{tabular}{|l|l|} \hline \textbf{Category} & \textbf{Diagram type} \ \hline Structure diagrams & Class diagrams \ \cline{2-2} & Component diagrams \ \cline{2-2} & Object diagrams \ \cline{2-2} & Composite structure diagrams \ \cline{2-2} & Deployment diagrams \ \cline{2-2} & Package diagrams \ \hline Behavior diagrams & Activity diagrams \ \cline{2-2} & Use case diagrams \ \cline{2-2} & State diagrams \ \hline Interaction diagrams & Sequence diagrams \ \cline{2-2} & Collaboration diagrams \ \cline{2-2} & Interaction overview diagrams \ \cline{2-2} & Timing diagrams \ \hline \end{tabular} \captionbelow*{Based on \protect\cite[p.~11]{Mittal2013}} \captionbelow[UML diagram types]{UML diagram types\ \lipsum[1-1]} \end{center} \end{table} \lipsum[5-5]

\cleardoublepage \newpage

\printbibliography

\end{document}

And here is the code trying to achieve the same but only by using KOMAscript:

\documentclass[
    captions=nooneline,
]{scrartcl}

\usepackage{lipsum}

\usepackage[ backend=biber, citestyle=authoryear, ]{biblatex} \addbibresource{\jobname.bib}

\begin{filecontents}{\jobname.bib} @Book{Mittal2013, title = {Netcentric System of Systems Engineering with DEVS Unified Process}, author = {Mittal, Saurabh and Martín, José L. R.}, publisher = {CRC Press}, year = {2013}, series = {System of systems engineering}, isbn = {978-1-4398-2707-9}, } \end{filecontents}

\usepackage[ hidelinks, breaklinks=true ]{hyperref} \hypersetup{ bookmarksopen=true, bookmarksopenlevel=3, bookmarksnumbered=true, linktoc=all, }

\begin{document} \listoftables \newpage

\lipsum[1-4] \begin{minipage}{\textwidth} \begin{center} \begin{tabular}{|l|l|} \hline \textbf{Category} & \textbf{Diagram type} \ \hline Structure diagrams & Class diagrams \ \cline{2-2} & Component diagrams \ \cline{2-2} & Object diagrams \ \cline{2-2} & Composite structure diagrams \ \cline{2-2} & Deployment diagrams \ \cline{2-2} & Package diagrams \ \hline Behavior diagrams & Activity diagrams \ \cline{2-2} & Use case diagrams \ \cline{2-2} & State diagrams \ \hline Interaction diagrams & Sequence diagrams \ \cline{2-2} & Collaboration diagrams \ \cline{2-2} & Interaction overview diagrams \ \cline{2-2} & Timing diagrams \ \hline \end{tabular} \end{center} Based on \cite[p.~11]{Mittal2013} \captionbelowof{table}[UML diagram types]{UML diagram types\ \lipsum[1-1]} \end{minipage}

\lipsum[5-5]

\cleardoublepage \newpage

\printbibliography

\end{document}

It mostly works but links are pointing to the caption instead of the table.

ViToni
  • 203
  • The hypcap package raises hyperlinks to the top of figure, although I'm not sure if it is KOMA compatible either. See also https://tex.stackexchange.com/questions/22177/can-the-package-caption-be-used-with-komascript-classes/383025?r=SearchResults&s=2|30.8253#383025 – John Kormylo Sep 07 '20 at 20:29
  • What error message do you get when using a recent version of the caption package? –  Sep 09 '20 at 13:35
  • Apparently the error I got was due to some issue I can't reproduce. Tested the MWE and my real document with a non-bounded version and it works. Corrected the question accordingly. – ViToni Sep 09 '20 at 17:01

0 Answers0