1

I'm having some strange behavior. My captions are wrapped as at the picture. This is probably cased by .sty and .cls files provided by an academic scholar, which are quite a mess. Someone has an idea, how to try to fix this? -- I know it would be good to provide whole code from .sty and .cls but they are big.

The code for the part at the picture look like this. (Generated with LyX)

\begin{minipage}[c][1\totalheight][t]{0.43\columnwidth}%
\begin{center}
\begin{figure}[H]
\centering{}\includegraphics{exemple3}\caption{A circular list of 1's}
\end{figure}

\par\end{center}%
\end{minipage}\qquad{}%
\begin{minipage}[c][1\totalheight][t]{0.43\columnwidth}%
\begin{center}
\begin{figure}[H]
\centering{}\includegraphics{exemple9}\caption{The same list unfolded to infinity}
\end{figure}

\par\end{center}%
\end{minipage}

And captions in the .sty file are set like this.

\captionsetup{font=small,labelfont={sf,bf}}

enter image description here

edit

The following is an effect of this code.

\captionsetup{font=small,labelfont={sf,bf},justification=raggedright}

enter image description here


This is everything what touch packages requests (or at least I hope so).

.sty

\ProvidesPackage{dcslib}[2012/03/01 v2.2 DCS Group library package]

\RequirePackage{listings}
\RequirePackage{longtable}
\RequirePackage{ifthen}
\RequirePackage{array}
\RequirePackage{graphicx}
\RequirePackage{xcolor}
\RequirePackage{url}
\RequirePackage{soul}
\RequirePackage{prettyref}
\RequirePackage{setspace}
\RequirePackage{translator}
\RequirePackage{subfig}
\RequirePackage{iftex}
\RequirePackage{amsmath}
\RequirePackage{amssymb}


% support for XeTeX and LuaTeX
\newif\ifunicodeengine
\ifXeTeX
  \unicodeenginetrue
\else
  \ifLuaTeX
    \unicodeenginetrue
  \else
    \RequirePackage[utf8]{inputenc}
    \RequirePackage[T1]{fontenc}
  \fi
\fi
\ifunicodeengine
  \RequirePackage{mathspec}
  \defaultfontfeatures{Ligatures=TeX}
\fi

% patch for compatibility between listings and XeTeX based on
% http://tex.stackexchange.com/questions/25391/the-listings-package-and-utf-8
\ifunicodeengine
  \input{listings-xetex-pl.tex}
\else
  \RequirePackage{listingsutf8}
  \lstset{inputencoding=utf8/latin2}
\fi

.cls

\ProvidesClass{dcsbook}[2012/03/01 v2.2 DCS Group book class]

\LoadClass[onecolumn,fontsize=10pt]{scrbook}

\RequirePackage[a4paper,onecolumn]{geometry}
\RequirePackage[pagestyles,clearempty,psfloats]{titlesec}
\RequirePackage{titletoc}
\RequirePackage{dcslib}[2012/03/01]
\RequirePackage[nottoc,notlot,notlof]{tocbibind}
\RequirePackage{calc}
\RequirePackage{translator}
\RequirePackage{flafter}
\RequirePackage{enumitem}
\RequirePackage{multicol}


% default monospace font
\ifunicodeengine
  % can be obtained from http://www.fontsquirrel.com/fonts/DejaVu-Sans-Mono
  \setallmonofonts[Scale=MatchLowercase]{DejaVu Sans Mono}
\else
  \RequirePackage{lmodern}
  \RequirePackage[scaled=0.82]{beramono}
\fi

.tex (generated by LyX)

\documentclass[oneside,twocolumn,english,british,thesis]{dcsbook}
\usepackage{fourier}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\pagestyle{plain}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{babel}
\usepackage{refstyle}
\usepackage{float}
\usepackage{amsthm}
\usepackage{amstext}

\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[unicode=true,pdfusetitle,
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=false,pdfborder={0 0 0},backref=false,colorlinks=false]
 {hyperref}

\usepackage{enumitem}       % customizable list environments

\usepackage{braket}
\usepackage{marvosym}
\usepackage{verbatim}
\usepackage{MnSymbol}
\usepackage{relsize}

Solution given by Axel Sommerfeldt in a comment

When using KOMA-Script the setting format=hang is the default one. So it seems to me you are searching for \captionsetup{format=plain} . See also: caption package documentation, section "KOMA-Script".

Number47
  • 135
  • 2
    Have you tried e.g. \caption{\raggedright A circular list of 1's}? – Charles Staats Oct 01 '13 at 15:13
  • I use LyX not raw tex, so I can't just edit the code. I've tried to add "\raggedright" tex snippet, before the caption's text, but it caused compilation fail. Still, it would probably cause the same as \captionsetup{font=small,labelfont={sf,bf},justification=raggedright}. – Number47 Oct 01 '13 at 16:15
  • 1
    When using KOMA-Script the setting format=hang is the default one. So it seems to me you are searching for \captionsetup{format=plain}. See also: caption package documentation, section "KOMA-Script". –  Oct 01 '13 at 19:10
  • @AxelSommerfeldt, yes that was it. Thank you. – Number47 Oct 01 '13 at 22:16

1 Answers1

3

Please always post complete documents showing the packages needed (caption I guess here)

\captionsetup{font=small,labelfont={sf,bf},justification=raggedright}

is probably what you are looking for.

Seeing as you are using caption anyway you can simplify

\begin{minipage}[c][1\totalheight][t]{0.43\columnwidth}%
\begin{center}
\begin{figure}[H]
\centering{}\includegraphics{exemple3}\caption{A circular list of 1's}
\end{figure}

\par\end{center}%
\end{minipage}

to

\begin{minipage}[c][1\totalheight][t]{0.43\columnwidth}%
\centering
\includegraphics{exemple3}
\captionof{figure}{A circular list of 1's}
\end{minipage}
David Carlisle
  • 757,742
  • Please always post complete documents showing the packages needed (caption I guess here) Then should I post 500 lines of code from the .sty and .cls files? -- Unfortunately justification=raggedright do not work. There may be something, what breaks correct formatting in those files, but I don't think anyone will want to go through them. -- Posted more details to the question. – Number47 Oct 01 '13 at 16:11