从主文档的附录或表格中获取引文,无需重写

从主文档的附录或表格中获取引文,无需重写

我正在写一篇使用主题分析的论文,论文中引用了大量采访文本。我想以叙述的方式撰写主题分析,并从数据中选取一两段引文来支持结果/论点。完整的引文表将位于正文或附录中。

我希望能够从此表中调用引文,而无需再次在正文中写入/复制引文,使用类似于数据库的 latex(参考和打印情况):在我的示例中,我想放置一个命令,将引文“A1”以 csquotes 样式放置在描述主题的引文部分下方。我附上了一个我希望它看起来像什么的示例。不幸的是,我没有一个最小的工作示例,因为我不确定如何称呼我正在寻找的东西。

提前致谢。

我希望它看起来像什么样子

编辑:这是用于生成示例的代码:

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}


\usepackage[acronym]{glossaries}
\usepackage{graphicx}

\usepackage{csquotes, hyperref, xcolor, booktabs, multirow, longtable}
\usepackage{tcolorbox}
\usepackage{datetime2} 
\usepackage{pdfpages}



%Title page
\title{A thematic analysis of canine food preferences}
\author{Dr Woofs}

%%%% GLOSSARY CONTENT %%%%%%
\makeglossaries


\begin{document}
\maketitle

\section{Results}
\subsection{Thematic analysis}
Results of the thematic analysis is given in \ref{tab:1}.
Three themes were identified; "wet food", "dry food", and "meal times"

\subsubsection{Wet food}
Wet food is preferred by most participants (A1, B5), mainly for its texture (A1).

\begin{displayquote} A1 - ``Wet food slides down easy"
\end{displayquote}

\subsubsection{Dry food}
Participants felt that they would eat dry food if it was available. (A2)

\begin{displayquote} A2 - ``If it's there I'll eat it"
\end{displayquote}



\begin{table}[]
\centering
\resizebox{\textwidth}{!}{%
\begin{tabular}{llll}
\textbf{Quote reference} & \textbf{Participant} & \textbf{Theme} & \textbf{Quote} \\ \hline
A1                      & Labrador              & Wet food       & Wet food slides down easy \\
A2                      & Labrador              & Dry food       & If it's there I'll eat it \\
B3                      & Staffie               & Meal times     & It should be early, after I wake up \\
B5                      & Staffie               & Wet food       & I prefer wet over dry, honestly \\
C3                      & Poodle                & Meal times     & I'm a punctual pup, and I expect others to be too \\

  
\end{tabular}%
}
\caption{Quotes about food preferences}
\label{tab:1}
\end{table}


\end{document}

答案1

我会保存所有引文及其参考资料,以供日后使用。这样,也可以直接输入表格。我使用csquotesbooktabs和,longtable因为您也会加载它们。

\documentclass[11pt,a4paper]{article}

\usepackage{csquotes,booktabs,longtable}

\makeatletter
\newcommand*{\quotelist}{}
\newcommand{\newquote}[4]{%
   \@ifundefined{quote@#1}{%
      \@namedef{quote@#1}{#4}%
      \g@addto@macro{\quotelist}{#1&#2&#3&#4\\}%
   }{\errmessage{Quote `#1' already defined}}%
}
\newcommand*{\usequote}[1]{%
   \@ifundefined{quote@#1}{\errmessage{Quote `#1' undefined}}{#1 - ``\textit{\@nameuse{quote@#1}}''}% style this as you want
}
\makeatother

\newquote{A1}{Labrador}{Wet food}{Wet food slides down easily}
\newquote{A2}{Labrador}{Dry food}{If it's there I'll eat it}
\newquote{B3}{Staffie}{Meal times}{It should be early, after I wake up}
\newquote{B5}{Staffie}{Wet food}{I prefer wet over dry, honestly}
\newquote{C3}{Poodle}{Meal times}{I'm a punctual pup, and I expect others to be too}
%\newquote{A1}{...}{...}{...} % raises error "Quote `A1' already defined."

\begin{document}
Text text text
\begin{displayquote}
\usequote{A2}
\end{displayquote}

% Or tabularx, or whatever you like
\begin{longtable}{@{}lllp{.3\linewidth}@{}}% .3\linewidth just to show the line wrapping
\textbf{Reference} & \textbf{Participant} & \textbf{Theme} & \textbf{Quote} \\
\midrule
\quotelist
\end{longtable}
\end{document}

在此处输入图片描述

相关内容