tikzpicture의 캡션 위치가 잘못되었습니다.

tikzpicture의 캡션 위치가 잘못되었습니다.

\subfloattikzpicture를 사용할 때 하위 캡션 배치에 문제가 있습니다 .

내 MWE는 다음과 같습니다.

\documentclass[a4paper,
               11pt,
               ngerman]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{caption}

\setkomafont{captionlabel}{\small\bfseries}
\setkomafont{caption}{\small}
\setcapindent{0em}
\setcapwidth{0.9\textwidth}
\captionsetup[subfigure]{font={footnotesize},labelfont={bf,footnotesize}}

\usepackage{tikz}
\usetikzlibrary{trees}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{patterns}
\usetikzlibrary{arrows}

\begin{document}

\tikzset{
    momentum/.style={postaction={decorate},
decoration={markings, mark=at position 1 with {\arrow[scale=0.8]{>}}}},
}

\begin{figure}[tb]
\subfloat[Winkel zwischen 1 und 3 am kleinsten]{
  \centering
  \begin{tikzpicture}[font=\small,scale=0.3]
    \centering
      \draw[momentum](5,5)--(5,1);
      \node[anchor=north]at(5,1){2};
      \draw[momentum](5,5)--(4,9);
      \node[anchor=east]at(4,9){1};
      \draw[momentum](5,5)--(6,9);
      \node[anchor=west]at(6,9){3};
  \end{tikzpicture}
} \hspace{1cm}
\subfloat[Winkel zwischen 2 und 3 am kleinsten]{
  \centering
  \begin{tikzpicture}[font=\small,scale=0.3]
    \centering
      \draw[momentum](5,5)--(5,1);
      \node[anchor=north]at(5,1){1};
      \draw[momentum](5,5)--(4,9);
      \node[anchor=east]at(4,9){2};
      \draw[momentum](5,5)--(6,9);
      \node[anchor=west]at(6,9){3};
  \end{tikzpicture}
} \hspace{1cm}
\subfloat[Alle Winkel etwa gleich groß]{
  \centering
  \begin{tikzpicture}[font=\small,scale=0.3]
    \centering
      \draw[momentum](5,5)--(5,1);
      \node[anchor=north]at(5,1){1};
      \draw[momentum](5,5)--(1,8);
      \node[anchor=east]at(1,8){2};
      \draw[momentum](5,5)--(9,8);
      \node[anchor=west]at(9,8){3};
  \end{tikzpicture} }
\caption{Bildunterschrift}
\end{figure}

\end{document}

컴파일되지만 내가 설정한 하위 캡션이 \subfloat[...]잘못 배치되었습니다.

mwe의 출력

비머 클래스에서 똑같은 코드를 사용하면 완벽하게 작동하기 때문에 이 시점에서 나는 완전히 길을 잃었습니다.

패키지 subfigure또는 subcaption. 하위 플로트를 미니페이지로 포장하는 것이 좋을 수도 있다는 내용을 어딘가에서 읽었지만 작동하지 않았습니다.

이것에 대한 아이디어가 있나요?

편집하다 @Troy 및 @John_Kormylo의 힌트를 사용하여 나에게 맞는 솔루션을 찾았습니다. 나는 주석을 달고 \setcapwidth{0.9\textwidth}tikzpicture를 사용하는 것을 제외한 모든 그림과 테이블에 추가했습니다... \setcapwidth{\textwidth}문제가 있는 하위 플로트 안에 넣어도 아무것도 바뀌지 않았습니다.

답변1

KOMA 클래스는 실제로 subfig. 대신 사용할 수 있습니다 subcaption.

\documentclass[
  a4paper,
  11pt,
  ngerman
]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{caption,subcaption}

\setkomafont{captionlabel}{\small\bfseries}
\setkomafont{caption}{\small}
\setcapindent{0em}
\setcapwidth{0.9\textwidth}
\captionsetup[subfigure]{font={footnotesize},labelfont={bf,footnotesize}}

\usepackage{tikz}
\usetikzlibrary{trees}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{patterns}
\usetikzlibrary{arrows}

\tikzset{
  momentum/.style={
    postaction={decorate},
    decoration={
      markings,
      mark=at position 1 with {\arrow[scale=0.8]{>}},
    },
  },
}

\begin{document}

\begin{figure}[tb]

\begin{subfigure}[b]{.3\textwidth}
\centering
\begin{tikzpicture}[font=\small,scale=0.3]
  \draw[momentum](5,5)--(5,1);
  \node[anchor=north]at(5,1){2};
  \draw[momentum](5,5)--(4,9);
  \node[anchor=east]at(4,9){1};
  \draw[momentum](5,5)--(6,9);
  \node[anchor=west]at(6,9){3};
\end{tikzpicture}
\caption{Winkel zwischen 1 und 3 am kleinsten}
\end{subfigure}\hfill
\begin{subfigure}[b]{.3\textwidth}
\centering
\begin{tikzpicture}[font=\small,scale=0.3]
  \draw[momentum](5,5)--(5,1);
  \node[anchor=north]at(5,1){1};
  \draw[momentum](5,5)--(4,9);
  \node[anchor=east]at(4,9){2};
  \draw[momentum](5,5)--(6,9);
  \node[anchor=west]at(6,9){3};
\end{tikzpicture}
\caption{Winkel zwischen 2 und 3 am kleinsten}
\end{subfigure}\hfill
\begin{subfigure}[b]{.3\textwidth}
\centering
\begin{tikzpicture}[font=\small,scale=0.3]
  \draw[momentum](5,5)--(5,1);
  \node[anchor=north]at(5,1){1};
  \draw[momentum](5,5)--(1,8);
  \node[anchor=east]at(1,8){2};
  \draw[momentum](5,5)--(9,8);
  \node[anchor=west]at(9,8){3};
\end{tikzpicture}
\caption{Alle Winkel etwa gleich groß}
\end{subfigure}

\caption{Bildunterschrift}
\end{figure}

\end{document}

여기에 이미지 설명을 입력하세요

답변2

\setcapdynwidthKOMA-Script 버전 3.20부터 대신 사용할 수 있습니다 \setcapwidth. KOMA 스크립트 문서에서:

원하는 대로 매개변수 너비 값으로 즉시 \setcapwidth설정된다는 점 에 유의하세요 . 대신 캡션이 설정된 경우 의 값을 원하는 경우 를 사용할 수 있습니다 . 예를 들어, 같은 길 이나 다른 명령을 인수로 사용하는 경우 결과에 차이가 있을 수 있습니다 .width\setlengthwidth\setcapdynwidth\linewidthwidth

\documentclass[a4paper,
               11pt,
               ngerman]{scrreprt}[2016/05/10]
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{caption}

\setkomafont{captionlabel}{\small\bfseries}
\setkomafont{caption}{\small}
\setcapindent{0em}
\setcapdynwidth{0.9\textwidth}% <- changed, needs KOMA-Script version 3.20
\captionsetup[subfigure]{font={footnotesize},labelfont={bf,footnotesize}}

\usepackage{tikz}
\usetikzlibrary{trees}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{patterns}
\usetikzlibrary{arrows}

\begin{document}

\tikzset{
    momentum/.style={postaction={decorate},
decoration={markings, mark=at position 1 with {\arrow[scale=0.8]{>}}}},
}

\begin{figure}[tb]
\subfloat[Winkel zwischen 1 und 3 am kleinsten]{
  \centering
  \begin{tikzpicture}[font=\small,scale=0.3]
    \centering
      \draw[momentum](5,5)--(5,1);
      \node[anchor=north]at(5,1){2};
      \draw[momentum](5,5)--(4,9);
      \node[anchor=east]at(4,9){1};
      \draw[momentum](5,5)--(6,9);
      \node[anchor=west]at(6,9){3};
  \end{tikzpicture}
} \hspace{1cm}
\subfloat[Winkel zwischen 2 und 3 am kleinsten]{
  \centering
  \begin{tikzpicture}[font=\small,scale=0.3]
    \centering
      \draw[momentum](5,5)--(5,1);
      \node[anchor=north]at(5,1){1};
      \draw[momentum](5,5)--(4,9);
      \node[anchor=east]at(4,9){2};
      \draw[momentum](5,5)--(6,9);
      \node[anchor=west]at(6,9){3};
  \end{tikzpicture}
} \hspace{1cm}
\subfloat[Alle Winkel etwa gleich groß]{
  \centering
  \begin{tikzpicture}[font=\small,scale=0.3]
    \centering
      \draw[momentum](5,5)--(5,1);
      \node[anchor=north]at(5,1){1};
      \draw[momentum](5,5)--(1,8);
      \node[anchor=east]at(1,8){2};
      \draw[momentum](5,5)--(9,8);
      \node[anchor=west]at(9,8){3};
  \end{tikzpicture} }
\caption{Bildunterschrift}
\end{figure}

\end{document}

결과:

여기에 이미지 설명을 입력하세요

관련 정보