테이블 환경에서만 cite 명령을 재정의하십시오.

테이블 환경에서만 cite 명령을 재정의하십시오.

natbib 패키지를 사용하여 논문 보고서를 인용하고 있습니다.

\usepackage[authoryear,sort,round]{natbib}
\bibliographystyle{apa}

인용은 텍스트에 괄호가 포함된 저자 연도로 되어 있으며 나에게 완벽하게 작동하도록 정렬되어 있습니다.

문제는 많은 수의 인용이 포함된 테이블 환경에 매우 큰 열이 있다는 것입니다. 테이블 내부에 auhtoryear 스타일을 유지하면 사용자 정의 열을 사용하더라도 테이블 너비를 텍스트 너비로 정렬하기가 어렵습니다.

%ltxtable configuration
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X} % flush-left, while allowing hyphenation
\newcolumntype{C}{>{\Centering\arraybackslash}X} % centered, while allowing hyphenation
\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash}p{#1}}

테이블 환경 내에서만 작성자 스타일 대신 대괄호로 번호를 매기도록 cite 명령을 재정의해야 합니다. 또한 대괄호를 위 첨자로 표시하고 싶고 이미 해결책을 찾았지만 항상 작성자 연도 스타일을 사용합니다.

\usepackage{letltxmacro}

\LetLtxMacro{\originalcite}{\cite}
\def\tablecite#1#{%
  \def\pretablecite{#1}%
  \tableciteaux}
\def\tableciteaux#1{%
  \textsuperscript{\expandafter\originalcite\pretablecite{#1}}%
}
\AtBeginEnvironment{table}{\let\cite\tablecite}

내 문서(최소= 필요한 코드)는 다음과 같습니다.

\documentclass[12pt,fleqn,a4paper]{book} % Default font size and left-justified equations

\usepackage{etoolbox}

% Bibliography
\usepackage[authoryear,sort,round]{natbib}
\bibliographystyle{apa}%this one order the list of references whereas abbrvnat is the elsevier thing;

\usepackage{afterpage}
\usepackage{capt-of}% or use the larger `caption` package
\usepackage{textcomp} % display ' apostrophe
\usepackage{dirtytalk} % access \say
\usepackage{longtable} %access longtable
\usepackage{lscape} %access landscape
\usepackage{pdflscape} % To rotate the page when using landscape & longtable
\usepackage{multirow} %access multirow
\usepackage{booktabs} %access \toprule & \bottomrule \cmidrule
\usepackage{changepage}%adjustwidth
\usepackage{ragged2e} % access \justify 
\usepackage{tabularx,ltxtable}
\usepackage{array}

%ltxtable configuration
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X} % flush-left, while allowing hyphenation
\newcolumntype{C}{>{\Centering\arraybackslash}X} % centered, while allowing hyphenation
\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash}p{#1}}

%To change the citation in the table environment 
\usepackage{letltxmacro}

\LetLtxMacro{\originalcite}{\cite}
\def\tablecite#1#{%
  \def\pretablecite{#1}%
  \tableciteaux}
\def\tableciteaux#1{%
  \textsuperscript{\expandafter\originalcite\pretablecite{#1}}%
}
\AtBeginEnvironment{table}{\let\cite\tablecite}

\begin{document}

\begingroup % restrict scope of reset of \textwidth parameter
\setlength\textwidth\textheight
\setlength\tabcolsep{1.25pt}
\begin{table}
\footnotesize
\renewcommand{\arraystretch}{1}%to keep the consistency and got similar render as longtable
\centering
\begin{tabular}{P{3.5cm}P{6cm}P{10cm}}
\toprule
\textbf{C1} & \textbf{C2} & \textbf{C3}\\
\midrule
DL.1. & C1.1. & reg \cite{cit1,cit2,cit3,cit4}, local \cite{cit1,cit2,cit3,cit4}, urban \cite{cit1,cit2,cit3,cit4}, rural \cite{cit1,cit2,cit3,cit4}\\
\phantom{C1} & C1.2. &pla \cite{cit1,cit2,cit3,cit4}, evaluation \cite{cit1,cit2,cit3,cit4}, frameworks \cite{cit1,cit2,cit3,cit4}\\
\phantom{C1} & C1.3. Envi&env and eco \cite{cit1,cit2,cit3,cit4}, lca \cite{cit1,cit2,cit3,cit4}\\
\phantom{C1} & C1.4. evaluation and assessment&investments \cite{cit1,cit2,cit3,cit4}, assessment ms \cite{cit1,cit2,cit3,cit4}, options \cite{cit1,cit2,cit3,cit4}, alternatives \cite{cit1,cit2,cit3,cit4}, plants \cite{cit1,cit2,cit3,cit4}, scenarios \cite{cit1,cit2,cit3,cit4}, production pathways\cite{cit1,cit2,cit3,cit4}\\
\phantom{C1} & C1.5. Site &projects \cite{cit1,cit2,cit3,cit4}, plants \cite{cit1,cit2,cit3,cit4}, stations \cite{cit1,cit2,cit3,cit4}, farms \cite{cit1,cit2,cit3,cit4}\\
\bottomrule
\end{tabular}
\caption{Caption.}
\label{tab:examples}
\end{table}
\endgroup

\bibliography{bibliography}

\end{document}

관련 정보