我有以下程式碼:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb} % for "\checkmark" macro
\usepackage{graphicx} % remove "demo" option in real document
\usepackage{float}
\usepackage{caption}
\usepackage{subcaption}
\renewcommand\thesubfigure{(\alph{subfigure})}
\captionsetup[subfigure]{labelformat=simple}
\makeatletter
\renewcommand{\p@subfigure}{\thefigure~} % unbreakable space after fig. #
\makeatother
\begin{document}
\begin{figure}[ht!]
\centering
%Insere Figura
\caption{Figure Description}
\includegraphics[scale=0.6]{img/tex.png}
\legend{Source: (Blokland2013)}
\label{fig:testemultiplataforma}
\end{figure}
\begin{figure}[!ht]
\centering
\caption{Figure Description}
\begin{subfigure}{0.5\textwidth}
\centering
\includegraphics[width=\textwidth]{img/tex.png}
\caption{Figure 1}
\label{fig:DifExp2Per4Tarefa1IF}
\end{subfigure}%
%\qquad
%add desired spacing between images, e. g. ~, \quad, \qquad etc.
%(or a blank line to force the subfigure onto a new line)
\begin{subfigure}{0.5\textwidth}
\centering
\includegraphics[width=\textwidth]{img/tex.png}
\caption{Figure 2}
\label{fig:DifExp2Per4Tarefa2IF}
\end{subfigure}
\legend{Source: Own authorship}
\label{fig:DifExp2Per4IF}
\end{figure}
\end{document}
在我的原始文件中有命令\legend{}
,但我已經查看了文件cls
和所有包的導入,我不知道這個命令來自哪裡。這個命令來自哪個套件?
我應該如何legend
按照下圖將文字左對齊而不是居中對齊?
例子:
答案1
據我了解,您喜歡使用圖例作為圖像來源的通知。為此目的已經開發了包copyrightbox
。透過它你可以獲得:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb} % for "\checkmark" macro
\usepackage[demo]{graphicx} % remove "demo" option in real document
\usepackage{float}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{copyrightbox}% <--- added
\renewcommand\thesubfigure{(\alph{subfigure})}
\captionsetup[subfigure]{labelformat=simple}
\makeatletter
\renewcommand{\p@subfigure}{\thefigure~} % unbreakable space after fig. #
%
\renewcommand{\CRB@setcopyrightfont}{% < ---for changing copyright font color/shape/family
\footnotesize
\color{black}%
}
\makeatother
\begin{document}
\begin{figure}[ht!]
\centering
\caption{Figure Description}
\label{fig:testemultiplataforma}
\copyrightbox[b]{\includegraphics[scale=0.6]{img/tex.png}}{Source: Blokland2013}
\end{figure}
\begin{figure}[!ht]
\centering
\caption{Figure Description}
\label{fig:DifExp2Per4IF}
\copyrightbox[b]{\begin{subfigure}{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{img/tex.png}
\caption{Figure 1}
\label{fig:DifExp2Per4Tarefa1IF}
\end{subfigure}\quad
\begin{subfigure}{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{img/tex.png}
\caption{Figure 2}
\label{fig:DifExp2Per4Tarefa2IF}
\end{subfigure}}{Source: Own authorship}
\end{figure}
\end{document}
編輯:
透過定義新命令legend
:
\newcommand\legend[1]{%
\captionsetup{font=small,singlelinecheck=off}
\caption*{#1}}
您可以獲得:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb} % for "\checkmark" macro
\usepackage[demo]{graphicx} % remove "demo" option in real document
\usepackage{float}
\usepackage{caption}
\newcommand\legend[1]{%
\captionsetup{font=small,singlelinecheck=off}
\caption*{#1}}
\usepackage{subcaption}
\renewcommand\thesubfigure{(\alph{subfigure})}
\captionsetup[subfigure]{labelformat=simple}
\makeatletter
\renewcommand{\p@subfigure}{\thefigure~} % unbreakable space after fig. #
\makeatother
\begin{document}
\begin{figure}[ht!]
\centering
\caption{Figure Description}
\label{fig:testemultiplataforma}
\includegraphics[scale=0.6]{img/tex.png}%}{Source: Blokland2013}
\legend{Source: Blokland2013}
\end{figure}
\begin{figure}[!ht]
\centering
\caption{Figure Description}
\label{fig:DifExp2Per4IF}
\begin{subfigure}{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{img/tex.png}
\caption{Figure 1}
\label{fig:DifExp2Per4Tarefa1IF}
\end{subfigure}\quad
\begin{subfigure}{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{img/tex.png}
\caption{Figure 2}
\label{fig:DifExp2Per4Tarefa2IF}
\end{subfigure}
\legend{Source: Own authorship}
\end{figure}
\end{document}
答案2
包起來非常簡單copyrightbox
:
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{ebgaramond}
\usepackage{graphicx}
\usepackage{copyrightbox}
\usepackage{caption}
\begin{document}
\begin{figure}[!htb]
\centering
\caption{Heinrich Füssli – The Nightmare (1781)}
\copyrightbox[b]{\includegraphics{Nightmare_Fussli}}{Detroit Institute of Arts}
\end{figure}%
\end{document}
允許的展示位置使用可選參數:[l]
、[r]
(預設)或[b]