图表和子图表的标题应左对齐

图表和子图表的标题应左对齐

您能针对这种情况给我一些建议吗?非常感谢。

我想将所有标题移至左边。

但是如果我们想绘制下图中有两个子图,那么我们必须使用“caption”和“subcaption”包,但这两个包不允许我们将所有图形标题都移到左边。


\documentclass[smallextended,referee,envcountsect]{svjour3}
\smartqed
\usepackage{graphicx}
\usepackage[hyperfootnotes=false]{hyperref}
\hypersetup{colorlinks=true,citecolor=blue,linkcolor=blue,urlcolor=blue}
\usepackage{amsmath,amsxtra,amssymb,latexsym,amsfonts,amscd}
\usepackage{multicol,color}
\usepackage{float}
\usepackage{soul}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{pstricks-add}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\usepackage{amssymb}
\usepackage{theorem}
\usepackage{fancyhdr}

\usepackage{tikz}
\usepackage{enumerate}
\usepackage[margin=1.1in]{geometry}
\parskip 5pt
\fancyfoot[C]{\thepage}
\setlength{\textwidth}{6.31in}\setlength{\topmargin}{-0.25in}
\setlength{\textheight}{9.2in}\setlength{\oddsidemargin}{0in}
\renewcommand{\baselinestretch}{1.1}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\def\disp{\displaystyle}
\begin{document}

\begin{center}
\begin{figure}[!tbp]
\begin{subfigure}[b]{0.45\textwidth}
\definecolor{uuuuuu}{rgb}{0.26666666666666666,0.26666666666666666,0.26666666666666666}
\definecolor{zzttqq}{rgb}{0.6,0.2,0.}
\definecolor{ududff}{rgb}{0.30196078431372547,0.30196078431372547,1.}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.75cm,y=0.75cm]
\clip(-5.039786976492287,-4.976475903092999) rectangle (5.225636493163389,4.854891605900701);
\fill[line width=2.pt,color=zzttqq,fill=zzttqq,fill opacity=0.10000000149011612] (-2.9782972019669014,-3.011675055168333) -- (3.0217027980330986,-3.011675055168333) -- (3.021702798033099,2.9883249448316658) -- (-2.9782972019669005,2.988324944831667) -- cycle;
\draw [line width=2.pt,color=zzttqq] (-2.9782972019669014,-3.011675055168333)-- (3.0217027980330986,-3.011675055168333);
\draw [line width=2.pt,color=zzttqq] (3.0217027980330986,-3.011675055168333)-- (3.021702798033099,2.9883249448316658);
\draw [line width=2.pt,color=zzttqq] (3.021702798033099,2.9883249448316658)-- (-2.9782972019669005,2.988324944831667);
\draw [line width=2.pt,color=zzttqq] (-2.9782972019669005,2.988324944831667)-- (-2.9782972019669014,-3.011675055168333);
\begin{scriptsize}
\draw [fill=ududff] (-2.9782972019669014,-3.011675055168333) circle (2.5pt);
\draw [fill=ududff] (3.0217027980330986,-3.011675055168333) circle (2.5pt);
\draw [fill=uuuuuu] (3.021702798033099,2.9883249448316658) circle (2.5pt);
\draw [fill=uuuuuu] (-2.9782972019669005,2.988324944831667) circle (2.5pt);
\end{scriptsize}
\end{tikzpicture}
\vspace*{-0.1in}
\caption{\bf This is a square.}
\label{picnew}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\definecolor{uuuuuu}{rgb}{0.26666666666666666,0.26666666666666666,0.26666666666666666}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.4cm,y=0.4cm]
\clip(-10.437883908168581,-9.13468903671252) rectangle (10.578095056602637,9.583415234871898);
\draw [line width=2.pt] (0.,0.) circle (2.4cm);
\begin{scriptsize}
\draw [fill=uuuuuu] (0.,0.) circle (2.0pt);
\end{scriptsize}
\end{tikzpicture}
\vspace*{-0.1in}
\caption{\bf This is a circle.}
\label{pic2a*}
\end{subfigure}
\caption{\bf Geometry.}
\end{figure}
\end{center}

\end{document}

答案1

您的代码存在更多问题:

  • 在你的 mwe 的序言中,有些包加载了两次
  • 文档类svjour3加载graphicx,因此您不需要加载它们(两次!)
  • tikz无法处理您使用的如此精确的定义坐标。将其四舍五入到小数点后两位就足够了
  • 与您的问题相关的只有以下包:tikzsubcaptionhyperref
  • 浮动环境不应该位于其他环境内,例如centerminipage...
  • 对于标题和子标题的左对齐,请使用标题设置\captionsetup{singlelinecheck=off}

编辑: 大部分是主题...

  • 你的图像代码确实没有必要那么复杂
  • 根据我的经验,对于几何元素来说,使用包中定义的形状要简单得多tikzrectangle,圆)
  • 有关字幕和子字幕的设置,请参阅captionsubcaption包的文档,它们都是 LaTeX 安装的一部分
  • 颜色定义应该在文档序言中
  • 序言中的变化由% <---

考虑到上述情况,mwe 是:

\documentclass[smallextended,referee,envcountsect]{svjour3}
\usepackage[margin=1.1in]{geometry}
\smartqed
\usepackage{tikz}
\usetikzlibrary{arrows}
\definecolor{uuuuuu}{rgb}{0.26666666666666666,0.26666666666666666,0.26666666666666666}
\definecolor{zzttqq}{rgb}{0.6,0.2,0.}
\definecolor{ududff}{rgb}{0.30196078431372547,0.30196078431372547,1.}
\usepackage{subcaption}
\captionsetup{skip=0.5ex,           % <---
              font=bf,              % <---
              singlelinecheck=off}  % <---
\captionsetup{skip=0.5ex}           % <---
\captionsetup[subfigure]{skip=0ex}  % <---
\def\disp{\displaystyle}

\usepackage[hyperfootnotes=false]{hyperref}
    \hypersetup{colorlinks=true,
            citecolor=blue,
            linkcolor=blue,
            urlcolor=blue}

\begin{document}
    \begin{figure}[!htbp]
\tikzset{% definiton of used styles
box/.style args = {#1/#2}{rectangle, draw=#1, fill=#1, minimum size=#2,
                          line width=2pt, fill opacity=0.1,
                          outer sep=0pt},
cir/.style args = {#1/#2/#3}{circle, draw=#1, fill=#2, minimum size=#3,
                             line width=2pt},
dot/.style = {circle, draw, thin, fill=#1,
              inner sep=0pt, outer sep=0pt, minimum size=5pt},
        }            
\begin{subfigure}[b]{0.45\linewidth}
        \noindent\begin{tikzpicture}
\node (s) [box=zzttqq/45mm] {};
\foreach \i/\j in {north east/uuuuuu, north west/uuuuuu, 
                  south west/ududff, south east/ududff}
    \node [dot=\j] at (s.\i) {};
    \end{tikzpicture}
\caption{\bf This is a square.}
\label{picnew}
    \end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\linewidth}
    \begin{tikzpicture}[x=0.4cm,y=0.4cm]
\node (s) [cir=black/white/45mm] {};%(2.4cm);
\node [dot=uuuuuu] {};
    \end{tikzpicture}
\caption{This is a circle.}
\label{pic2a*}
\end{subfigure}
\caption{Geometry.}
\end{figure}

\end{document}

在此处输入图片描述

相关内容