편집하다:

편집하다:

나는 다음을 가지고 있습니다 :

\documentclass[11pt, a4paper]{report}
\usepackage{bm}
\usepackage{amsfonts, graphicx, verbatim, amsmath,amssymb, amsthm}
\usepackage{color}
\usepackage{array}
\usepackage{setspace}% if you must (for double spacing thesis)
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage{tikz}
\usepackage{parskip}
\usepackage{lipsum}
    \newtheorem{theorem}{Theorem}[section]
\newtheorem{example}[theorem]{Example}   

 \begin{document}
    \begin{example} 
    Consider a random walk on the $n$-cycle. Let $\Omega = \mathbb{Z}_n = \lbrace 0, 1, 2, \cdots, n-1 \rbrace$ be the set of remainders modulo $n$. Also consider the transition matrix:
    \[
    P(x,y) = 
    \begin{cases} 
    \frac{1}{2} & \text{if } y=x+1\;\; (mod\;n)\\
    \frac{1}{2} & \text{if } y=x-1\;\; (mod\;n)\\
    0 & \text{otherwise}
    \end{cases}
    \]

    The associated Markov chain $X_t$ is called a random walk on the $n$-cycle. The sates can be visualised as equally spaced nodes arranged in a circle(see figure 1.1)
    \end{example}

    \begin{figure}[htbp]
        \centering
        \begin{tikzpicture}
        \foreach \i in {90,54,...,-234} {
            \draw[ultra thick] (\i:2)--({\i-36}:2);
        }
        \foreach \i in {90,18,...,-198} {
            \draw[fill=black] (\i:2) circle (1.25mm);
        }
        \foreach \i in {54,-18,...,-234} {
            \draw[fill=white] (\i:2) circle (1.25mm);
        }
        \begin{scope}[xshift=5cm]
        \foreach \i in {90,50,...,-230} {
            \draw[ultra thick] (\i:2)--({\i-40}:2);
            \draw[fill=black] (\i:2) circle (1.25mm);
        }
        \end{scope}
        \end{tikzpicture}
        \caption{Random walk on $\mathbb{Z}_10$ is periodic, since every step
    goes from an even state to an odd state, or vice-versa. Random
    walk on $\mathbb{Z}_9$ is aperiodic.}
        \label{my:figure}
    \end{figure}
    \end{document}

이제 "가운데로 밀어넣고 싶다"는 의미에서 캡션의 간격을 조정하고 싶은데 어떻게 진행해야 할지 모르겠습니다.

편집하다: 위와 비슷한 질문이지만 이 경우 캡션이 끔찍해 보입니다. 캡션을 늘릴 수 있는 수정 사항은 다음과 같습니다.

\begin{example} Consider the graph $G$ following shown in figure 1.2. The transition matrix of a simple random walk $G$ is 

\begin{equation*}
P =
\begin{bmatrix}[1.25]
    0 & \frac{1}{3} & \frac{1}{3} & \frac{1}{3} & 0 & 0 \\
    \frac{1}{4} & 0 & \frac{1}{4} & 0 & \frac{1}{4} & \frac{1}{4} \\
    \frac{1}{4} & \frac{1}{4} & 0 & \frac{1}{4} & \frac{1}{4} & 0 \\
    \frac{1}{3} & 0 & \frac{1}{3} & 0 & \frac{1}{3} & 0 \\
    0 & \frac{1}{4} & \frac{1}{4} & \frac{1}{4} & 0 & \frac{1}{4} \\
    0 & \frac{1}{2} & 0 & 0 & \frac{1}{2} & 0 \\
\end{bmatrix}
\end{equation*}

\begin{figure}[htbp]
 \centering
 \ffigbox[1.1\FBwidth]{%
 \caption{An example of a vertex set $V = \lbrace 1, 2, 3, 4, 5, 6\rbrace$ with $10$ edges.}
 \label{my:figure}}%
 {\begin{tikzpicture}[bn/.style={circle,fill,draw,text=white,font=\sffamily,minimum
size=1mm},every node/.append style={bn}]
 \path node (1) {1} -- ++ (50:2.5) node (2) {2} -- ++(-95:1.75) node (3) {3}
 -- ++(-85:1.75) node (4) {4} -- ++(40:2.75) node (5) {5}
 -- ++ (0,1.75) node (6) {6} ;
 \draw[thick] (1)--(2)--(6)--(5)--(4)--(1)--(3)--(5)--(2)--(3)--(4);
\end{tikzpicture}}%
\end{figure}
\end{example}

이것을 최대 2줄로 늘릴 수 있는 방법이 있습니까?

답변1

내가 이해한 것이 맞다면 서문에 다음 두 줄을 사용할 수 있습니다.

\usepackage{caption} % <================================================
\captionsetup{width=0.8\textwidth} % <==================================

캡션이 텍스트 너비의 80%만 사용하도록 합니다. 콘솔/터미널에 caption입력하여 캡션 레이아웃을 조작할 수 있는 더 많은 가능성은 패키지 설명서를 참조하세요 .texdoc caption

완전한 코드

\documentclass[11pt, a4paper]{report}
\usepackage{bm}
\usepackage{amsfonts, graphicx, verbatim, amsmath,amssymb, amsthm}
\usepackage{color}
\usepackage{array}
\usepackage{setspace}% if you must (for double spacing thesis)
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage{tikz}
\usepackage{parskip}
\usepackage{lipsum}

\usepackage{caption} % <================================================
\captionsetup{width=0.8\textwidth} % <==================================

\newtheorem{theorem}{Theorem}[section]
\newtheorem{example}[theorem]{Example}   


\begin{document}

\begin{example} 
Consider a random walk on the $n$-cycle. 
Let $\Omega = \mathbb{Z}_n = \lbrace 0, 1, 2, \cdots, n-1 \rbrace$ be 
the set of remainders modulo $n$. Also consider the transition matrix:
\[
  P(x,y) = 
  \begin{cases} 
    \frac{1}{2} & \text{if } y=x+1\;\; (mod\;n)\\
    \frac{1}{2} & \text{if } y=x-1\;\; (mod\;n)\\
    0           & \text{otherwise}
  \end{cases}
\]

The associated Markov chain $X_t$ is called a random walk on the 
$n$-cycle. The sates can be visualised as equally spaced nodes arranged 
in a circle (see figure~\ref{my:figure}). % <==========================
\end{example}

\begin{figure}[htbp]
  \centering
  \begin{tikzpicture}
        \foreach \i in {90,54,...,-234} {
            \draw[ultra thick] (\i:2)--({\i-36}:2);
        }
        \foreach \i in {90,18,...,-198} {
            \draw[fill=black] (\i:2) circle (1.25mm);
        }
        \foreach \i in {54,-18,...,-234} {
            \draw[fill=white] (\i:2) circle (1.25mm);
        }
        \begin{scope}[xshift=5cm]
        \foreach \i in {90,50,...,-230} {
            \draw[ultra thick] (\i:2)--({\i-40}:2);
            \draw[fill=black] (\i:2) circle (1.25mm);
        }
        \end{scope}
  \end{tikzpicture}
  \caption{Random walk on $\mathbb{Z}_10$ is periodic, since every step
    goes from an even state to an odd state, or vice-versa. Random
    walk on $\mathbb{Z}_9$ is aperiodic.}
  \label{my:figure}
\end{figure}
Text after the figure.
\end{document}

결과를 제공합니다:

결과 PDF

편집하다:

두 번째 예에서는 (주석을 붙인 후 코드 \ffigbox표시를 참조하십시오 )<======

\documentclass[11pt, a4paper]{report}
\usepackage{bm}
\usepackage{amsfonts, graphicx, verbatim, amsmath,amssymb, amsthm}
\usepackage{color}
\usepackage{array}
\usepackage{setspace}% if you must (for double spacing thesis)
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage{tikz}
\usepackage{parskip}
\usepackage{lipsum}

\usepackage{floatrow}

\usepackage{caption} % <================================================
\captionsetup{width=0.8\textwidth} % <==================================

\newtheorem{theorem}{Theorem}[section]
\newtheorem{example}[theorem]{Example}   


\begin{document}

\begin{example} 
Consider a random walk on the $n$-cycle. 
Let $\Omega = \mathbb{Z}_n = \lbrace 0, 1, 2, \cdots, n-1 \rbrace$ be 
the set of remainders modulo $n$. Also consider the transition matrix:
\[
  P(x,y) = 
  \begin{cases} 
    \frac{1}{2} & \text{if } y=x+1\;\; (mod\;n)\\
    \frac{1}{2} & \text{if } y=x-1\;\; (mod\;n)\\
    0           & \text{otherwise}
  \end{cases}
\]

The associated Markov chain $X_t$ is called a random walk on the 
$n$-cycle. The sates can be visualised as equally spaced nodes arranged 
in a circle (see figure~\ref{my:figure}).
\end{example}

\begin{figure}[htbp]
  \centering
  \begin{tikzpicture}
        \foreach \i in {90,54,...,-234} {
            \draw[ultra thick] (\i:2)--({\i-36}:2);
        }
        \foreach \i in {90,18,...,-198} {
            \draw[fill=black] (\i:2) circle (1.25mm);
        }
        \foreach \i in {54,-18,...,-234} {
            \draw[fill=white] (\i:2) circle (1.25mm);
        }
        \begin{scope}[xshift=5cm]
        \foreach \i in {90,50,...,-230} {
            \draw[ultra thick] (\i:2)--({\i-40}:2);
            \draw[fill=black] (\i:2) circle (1.25mm);
        }
        \end{scope}
  \end{tikzpicture}
  \caption{Random walk on $\mathbb{Z}_10$ is periodic, since every step
    goes from an even state to an odd state, or vice-versa. Random
    walk on $\mathbb{Z}_9$ is aperiodic.}
  \label{my:figure}
\end{figure}
Text after the figure.

\clearpage
\begin{example} Consider the graph $G$ following shown in figure 1.2. The transition matrix of a simple random walk $G$ is 

\begin{equation*}
P =
\begin{bmatrix}[1.25]
    0 & \frac{1}{3} & \frac{1}{3} & \frac{1}{3} & 0 & 0 \\
    \frac{1}{4} & 0 & \frac{1}{4} & 0 & \frac{1}{4} & \frac{1}{4} \\
    \frac{1}{4} & \frac{1}{4} & 0 & \frac{1}{4} & \frac{1}{4} & 0 \\
    \frac{1}{3} & 0 & \frac{1}{3} & 0 & \frac{1}{3} & 0 \\
    0 & \frac{1}{4} & \frac{1}{4} & \frac{1}{4} & 0 & \frac{1}{4} \\
    0 & \frac{1}{2} & 0 & 0 & \frac{1}{2} & 0 \\
\end{bmatrix}
\end{equation*}

\begin{figure}[htbp]
 \centering
%\ffigbox[1.1\FBwidth]{% <==============================================
 \caption{An example of a vertex set $V = \lbrace 1, 2, 3, 4, 5, 6\rbrace$ with $10$ edges.}
 \label{my:figure}%
%}% <===================================================================
 {\begin{tikzpicture}[bn/.style={circle,fill,draw,text=white,font=\sffamily,minimum
size=1mm},every node/.append style={bn}]
 \path node (1) {1} -- ++ (50:2.5) node (2) {2} -- ++(-95:1.75) node (3) {3}
 -- ++(-85:1.75) node (4) {4} -- ++(40:2.75) node (5) {5}
 -- ++ (0,1.75) node (6) {6} ;
 \draw[thick] (1)--(2)--(6)--(5)--(4)--(1)--(3)--(5)--(2)--(3)--(4);
\end{tikzpicture}}%
\end{figure}
\end{example}
\end{document}

결과적으로 두 번째 그림/페이지를 얻습니다.

두 번째 페이지

답변2

원하는 내용을 잘 이해했다면 캡션 너비를 완전히 제어할 수 있는 의 \ffigbox명령을 사용하면 쉽습니다.floatrow

\documentclass[11pt, a4paper]{report}
\usepackage{bm}
\usepackage{graphicx, verbatim, amsmath,amssymb, amsthm}
\usepackage{color}
\usepackage{array}
\usepackage{setspace}% if you must (for double spacing thesis)
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage{tikz}
\usepackage{parskip}
\usepackage{lipsum}
    \newtheorem{theorem}{Theorem}[section]
\newtheorem{example}[theorem]{Example}
\usepackage{floatrow}

 \begin{document}

    \begin{example}
    Consider a random walk on the $n$-cycle. Let $\Omega = \mathbb{Z}_n = \lbrace 0, 1, 2, \cdots, n-1 \rbrace$ be the set of remainders modulo $n$. Also consider the transition matrix:
    \[
    P(x,y) =
    \begin{cases}
    \frac{1}{2} & \text{if } y=x+1 \pmod n\\
    \frac{1}{2} & \text{if } y=x-1\pmod n\\
    0 & \text{otherwise}
    \end{cases}
    \]

    The associated Markov chain $X_t$ is called a random walk on the $n$-cycle. The states can be visualised as equally spaced nodes arranged in a circle(see figure 1.1)
    \end{example}

 \begin{figure}[htbp]
 \centering
 \ffigbox[1.1\FBwidth]{%
 \caption{Random walk on $\mathbb{Z}_10$ is periodic, since every step
 goes from an even state to an odd state, or vice-versa. Random
 walk on $\mathbb{Z}_9$ is aperiodic.}
 \label{my:figure}}%
 {\begin{tikzpicture}
 \foreach \i in {90,54,...,-234} {
 \draw[ultra thick] (\i:2)--({\i-36}:2);
 }
 \foreach \i in {90,18,...,-198} {
 \draw[fill=black] (\i:2) circle (1.25mm);
 }
 \foreach \i in {54,-18,...,-234} {
 \draw[fill=white] (\i:2) circle (1.25mm);
 }
 \begin{scope}[xshift=5cm]
 \foreach \i in {90,50,...,-230} {
 \draw[ultra thick] (\i:2)--({\i-40}:2);
 \draw[fill=black] (\i:2) circle (1.25mm);
 }
 \end{scope}
 \end{tikzpicture}}%
 \end{figure}

\end{document} 

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

관련 정보