我遇到了一個簡單的問題。我想將表格的註釋向左對齊,並將註釋放在圖的標題後面,使用與此類日記中相同的格式:請參見此處:
我的原始程式碼如下。
\documentclass[12pt,a4paper]{article}
\usepackage{microtype}
\usepackage{sectsty}
\allsectionsfont{\centering}
\usepackage{indentfirst,amsmath,multicol,amssymb,booktabs,threeparttable}
\usepackage[font=small,format=plain,labelfont=bf,up,textfont=normal,up,justification=justified,singlelinecheck=false]{caption}
\usepackage{setspace}
\usepackage{bm}
\usepackage{geometry}
\usepackage[sort]{natbib}
\setlength{\bibsep}{2pt}
\geometry{top=1.4in,bottom=1.in,left=1in,right=1in}
\usepackage{grffile}
\usepackage{graphicx,subfig}
\graphicspath{{F:/}}
\usepackage{epstopdf}
\usepackage[svgnames]{xcolor}
\usepackage[colorlinks,linkcolor=blue,citecolor=blue]{hyperref}
\onehalfspacing
\begin{document}
\section{Tables}
\begin{table}[htp]
\small{\caption{Cal}}
\centering
\resizebox{0.8\columnwidth}{!}{
\begin{tabular}{llll}
\toprule
Par & Des & Val & Tar \\
\midrule
$\beta$ & Dis & 0.9 & Sta \\
\bottomrule
\end{tabular}
}
\begin{tablenotes}
\small \item \textit{Notes}:Parameters
\end{tablenotes}
\end{table}
\section{Figures}
\begin{figure}[htb]
\centering
\includegraphics[width=4in,scale=0.5]{jd}
\small{\caption{Jo.} \textit{Notes}: The.}
\end{figure}
\end{document}
我可以更改某種期刊中附件的標題格式嗎?即標題位於「表 1」下方;註釋左對齊;圖的標題以「圖 1」表示。
答案1
\documentclass[12pt,a4paper]{article}
\usepackage{microtype}
\usepackage{booktabs,tabularx}
\usepackage[font=small,format=plain,labelfont=bf,up,
textfont=normal,up,justification=justified,singlelinecheck=false]{caption}
\renewcommand{\figurename}{Fig. }
\renewcommand{\tablename}{Table }
\DeclareCaptionFormat{mytable}{#1#2\\#3}
\captionsetup[table]{format=mytable,labelsep=none}
\usepackage{geometry}
\geometry{top=1.4in,bottom=1.in,left=1in,right=1in}
\usepackage{graphicx}
\usepackage{caption}
\begin{document}
\begin{table}[t]
\caption{Cal}
{\centering\Huge
\begin{tabularx}{\linewidth}{>{\hfil}X>{\hfil}X>{\hfil}X>{\hfil}X}
\toprule
Par & Des & Val & Tar \\\midrule
$\beta$ & Dis & 0.9 & Sta \\\bottomrule
\end{tabularx}\par}\medskip
\textit{Notes}: Parameters
\end{table}
\begin{figure}[b]
{\centering
\includegraphics[width=4in,scale=0.5]{example-image}\par}
\caption{Jo.} \textit{Notes}: The.
\end{figure}
\end{document}
答案2
抱歉,在寫答案期間,我被(我的妻子)打斷了,我無法完成它......所以最好暫時刪除它。
編輯: 我回來了 :)
- 標題樣式應在標題設定中確定。如果我理解正確的話你喜歡
\usepackage[format=plain, font={small,up} labelfont=bf,
justification=justified, singlelinecheck=false]{caption}
後期本地手動設定可能會導致不一致
- 表格標題的格式與數字不同。它的附加選項可以決定寬度
\DeclareCaptionLabelSeparator{mytable}{:\par}%put in what you like
\captionsetup[table]{labelsep=mytable}
- 不要使用
\resizebox{0.8\columnwidth}{!}{ \begin{tabular}{llll} ... \end{tabular}}
更好的是使用tabularx
表環境及其列類型:
\begin{tabularx}{0.8\linewidth}{*{4}{>{\raggedright\arraybackslash}X}}
...
\end{tabularx}
如果一列中有小數,那麼最好考慮套件
S
中的列類型siunitx
,它可以在小數點處對齊數字並為數字符號保留空間(如果存在)threeparttable
因為當您想要在表格中新增註解時,您也會載入而不是使用它。我選擇將註釋設為段落並從表格的左邊緣開始圖形註釋可以是圖形標題(長部分)的一部分,例如:
\caption[figure name.]{Figure name.\newline
\emph{Notes}: some longer text in notes
}
完整的 MWE:
\documentclass[12pt,a4paper]{article}
\usepackage[top=1.4in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{bm}
\usepackage{microtype}
\usepackage{sectsty}
\allsectionsfont{\centering}
\usepackage{indentfirst,amsmath,multicol,amssymb,booktabs,threeparttable}
\usepackage[format=plain, font=small, labelfont=bf,
justification=justified, singlelinecheck=false]{caption}
\DeclareCaptionLabelSeparator{mytable}{:\par}%put in what you like
\captionsetup[table]{labelsep=mytable}
\captionsetup[figure]{name=Fig.}
\usepackage[demo]{graphicx}
\graphicspath{{F:/}}
\usepackage{subfig}
\usepackage{tabularx}
\usepackage{setspace}
\usepackage[sort]{natbib}
\setlength{\bibsep}{2pt}
\usepackage{grffile}
\usepackage{epstopdf}
\usepackage[svgnames]{xcolor}
\usepackage[colorlinks,linkcolor=blue,citecolor=blue]{hyperref}
\onehalfspacing
\usepackage{lipsum}% for text filler
\begin{document}
\section{Tables}
\begin{table}[htp]
\centering
\begin{threeparttable}
\caption{Cal}
\begin{tabularx}{0.6\linewidth}{*{4}{>{\raggedright\arraybackslash}X}}
\toprule
Par & Des & Val & Tar \\
\midrule
$\beta$ & Dis & 0.9 & Sta \\
\bottomrule
\end{tabularx}
\begin{tablenotes}[para,flushleft]\footnotesize
\item \textit{Notes}: Parameters
\end{tablenotes}
\end{threeparttable}
\end{table}
\section{Figures}
\begin{figure}[htb]
\centering
\includegraphics[width=4in]{jd}
\caption[figure name.]{Figure name.\newline
\emph{Notes}: \lipsum*[11]
}
\end{figure}
\end{document}
答案3
像這樣?
\documentclass[12pt, a4paper, demo]{article}
\usepackage{microtype}
\usepackage{sectsty}
\allsectionsfont{\centering}
\usepackage{indentfirst,amsmath,multicol,amssymb,booktabs,threeparttable}
\usepackage[font=small,format=plain,labelfont=bf,up,textfont=normal,up,justification=justified,singlelinecheck=false]{caption}
\captionsetup[table]{labelsep=newline}
\captionsetup[figure]{name=Fig., labelsep=period}
\usepackage{setspace}
\usepackage{bm}
\usepackage{geometry}
\usepackage{tabularx}
\usepackage[sort]{natbib}
\setlength{\bibsep}{2pt}
\geometry{top=1.4in,bottom=1.in,left=1in,right=1in}
\usepackage{grffile}
\usepackage{graphicx,subfig}
\graphicspath{{F:/}}
\usepackage{epstopdf}
\usepackage[svgnames]{xcolor}
\usepackage[colorlinks,linkcolor=blue,citecolor=blue]{hyperref}
\onehalfspacing
\begin{document}
\section{Tables}
\begin{table}[!htp]
\small
\caption[Cal]{Cal\\ \textit{Notes}:Parameters}
\begin{tabularx}{\linewidth}{*{4}{X}}
\toprule
Par & Des & Val & Tar \\
\midrule
$\beta$ & Dis & 0.9 & Sta \\
\bottomrule
\end{tabularx}
\end{table}
\section{Figures}
\begin{figure}[htb]
{\centering
\includegraphics[width=\linewidth]{jd}
\caption{Jo}}%
\textit{Notes}: The.
\end{figure}
\end{document}