我正在进行一次采访。我有一张“问题和解释”表格和一张“问题和答案”表格。我已标记了每一行,以便以后可以引用每个问题。我想更改标签,并针对每个采访对象引用不同的问题和答案表格:我想对表格中的每一行进行编号和标记,以便以后可以引用它们。
请帮忙谢谢
我的代码是:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[danish]{babel}
\usepackage{lscape}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{color}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{float}
\usepackage[top=2.81cm, bottom=2.75cm,right=2cm, left=2cm]{geometry}
\usepackage{url}
\usepackage[hidelinks]{hyperref}
\hypersetup{breaklinks=true}
\usepackage{setspace}
\onehalfspacing
\usepackage[T1]{fontenc}
%%% DETTE ER NUMERERING AF RÆKKER I TABELLER
\usepackage{etoolbox}
\usepackage{setspace}
\onehalfspacing
\usepackage{url}
\usepackage[hidelinks]{hyperref}
\hypersetup{breaklinks=true}
\newcounter{rowcntr}[table]
\makeatletter
% Assuming arabic numbers for the table number -- in case of bottom table caption, we have to increase the table number by one, only for output.
\usepackage{longtable}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{V}[1]{>{\raggedright\let\newline\\\arraybackslash}p{\dimexpr#1-2\tabcolsep-\arrayrulewidth}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\renewcommand{\therowcntr}{\@arabic{\numexpr\c@table+1}.\arabic{rowcntr}}
\makeatother
\newcolumntype{N}{>{\refstepcounter{rowcntr}\therowcntr}c}
\AtBeginEnvironment{tabular}{\setcounter{rowcntr}{0}}
%%% DETTE ER NUMERERING AF RÆKKER I TABELLER
\begin{document}
\section*{Interview questions}
The following table contains my interview questions and explanation
\begin{center}
\begin{longtable}{|N| c | V{7.6cm} | V{7.6cm} |}
\hline
\multicolumn{2}{|c}{} & \multicolumn{1}{c|}{\textbf{Question}} & \multicolumn{1}{c|}{\textbf{Explanation}} \\ \hline
\multicolumn{4}{|c|}{Interview phase 1}\\ \hline
\multicolumn{4}{|C{17.5cm}|}{\textit{Text This phase focus on ...TextTextTextTextText TextTextTextTextTextTextTextTextTextTextText TextText TextTextText TextTextTextTextTextTextTextTextTextText Text Text Text Text Text Text Text Text }}\\ \hline
\label{que:1} & A & Do you think ...? & This is a good question.\\
\label{que:2} & C & Do you feel Text & This is a good question.\\
\label{que:3} & E & What do you think of your previous boss & Relationship between employee and employer text Text textText text Text text Text text.\\ \hline
\multicolumn{4}{|c|}{Interview phase 2}\\ \hline
\multicolumn{4}{|C{17.5cm}|}{\textit{Text This phase focus on ... }}\\ \hline
\label{que:4} & D & Is this ...? & Good question.\\
\label{que:5} & I & Do you like Text & A good question.\\
\label{que:6} & A & what do you think of your mother & Relationship \\ \hline
\caption {Questions and explanation} \label{tab:interviewspg}
\end{longtable}
\end{center}
\section*{Interview answers person A}
The following section contains the answers from interviewperson A
\begin{center}
\begin{longtable}{|N| V{8.3cm} | V{8.3cm} |}
\hline
\multicolumn{1}{|c}{} & \multicolumn{1}{c|}{\textbf{Question}} & \multicolumn{1}{c|}{\textbf{Answer}} \\ \hline
\label{QA:1} & Do you think ...? & Yes I think.\\
\label{QA:2} & Do you feel Text & I feel a lot of text.\\
\label{QA:3} & What do you think of your previous boss & I hated him.\\
\label{QA:3a} & \textbf{This is an unexpected follow up question} \textbf{Why did you hate him?} & \textbf{Because he was evil.}\\
\label{QA:4} & Is this ...? & Yes\\
\label{QA:5} & Do you like Text & Text is good.\\
\label{QA6:6} & what do you think of your mother & I really like my mother \\ \hline
\caption {Questions and answers} \label{tab:interviewspg}
\end{longtable}
\end{center}
\newpage
\section*{Interview answers person B}
The following section contains the answers from interviewperson B
\begin{center}
\begin{longtable}{|N| V{8.3cm} | V{8.3cm} |}
\hline
\multicolumn{1}{|c}{} & \multicolumn{1}{c|}{\textbf{Question}} & \multicolumn{1}{c|}{\textbf{Answer}} \\ \hline
\label{QB:1} & Do you think ...? & No\\
\label{QB:2} & Do you feel Text & No you can't feel text\\
\label{QB:3} & What do you think of your previous boss & She was okay\\
\label{QB:4} & Is this ...? & No\\
\label{QB:5} & Do you like Text & Text is bad.\\
\label{QA6:6} & what do you think of your mother & I would like to not answer that \\ \hline
\caption {Questions and answers} \label{tab:interviewspg}
\end{longtable}
\end{center}
\end{document}
答案1
这是一种使用单独的interviewee
计数器和一个\subquest
命令来临时更改行计数器格式并为其提供正确标签的方法。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[danish]{babel}
\usepackage{lscape}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{color}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{float}
\usepackage[top=2.81cm, bottom=2.75cm,right=2cm, left=2cm]{geometry}
\usepackage{setspace}
\onehalfspacing
\usepackage[T1]{fontenc}
%%% DETTE ER NUMERERING AF RÆKKER I TABELLER
\usepackage{etoolbox}
\usepackage{setspace}
\onehalfspacing
\usepackage{url}
\usepackage[hidelinks]{hyperref}
\hypersetup{breaklinks=true}
\newcounter{rowcntr}
\newcounter{interviewee}
\newcounter{subquestion}
\renewcommand{\theinterviewee}{\Alph{interviewee}}
% This is meant for a subquestion
\newcommand{\subquest}{%
\stepcounter{subquestion}%
\addtocounter{rowcntr}{-1}%
\let\origtherowcntr\therowcntr%
\renewcommand{\therowcntr}{\origtherowcntr.\alph{subquestion}}%
\refstepcounter{rowcntr}%
}
\makeatletter
\newcommand{\prepareresultsections}{%
\setcounter{rowcntr}{0}
\@addtoreset{rowcntr}{table}
% Change the rowcntr format for the interview results
\renewcommand{\therowcntr}{\theinterviewee.\arabic{rowcntr}}
}
\makeatother
\newcommand{\resultsection}[1]{%
\clearpage
\refstepcounter{interviewee}%
\section*{#1}%
}
\makeatletter
% Assuming arabic numbers for the table number -- in case of bottom table caption, we have to increase the table number by one, only for output.
\usepackage{longtable}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{V}[1]{>{\raggedright\let\newline\\\arraybackslash}p{\dimexpr#1-2\tabcolsep-\arrayrulewidth}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
%\renewcommand{\therowcntr}{\@arabic{\numexpr\c@table+1}.\arabic{rowcntr}}
\makeatother
\newcolumntype{N}{>{\refstepcounter{rowcntr}\therowcntr}c}
\AtBeginEnvironment{tabular}{\setcounter{rowcntr}{0}\setcounter{subquestion}{0}}
%%% DETTE ER NUMERERING AF RÆKKER I TABELLER
\begin{document}
\section*{Interview questions}
The following table contains my interview questions and explanation
\begin{center}
\begin{longtable}{|N| c | V{7.6cm} | V{7.6cm} |}
\hline
\multicolumn{2}{|c}{} & \multicolumn{1}{c|}{\textbf{Question}} & \multicolumn{1}{c|}{\textbf{Explanation}} \\ \hline
\multicolumn{4}{|c|}{Interview phase 1}\\ \hline
\multicolumn{4}{|C{17.5cm}|}{\textit{Text This phase focus on ...TextTextTextTextText TextTextTextTextTextTextTextTextTextTextText TextText TextTextText TextTextTextTextTextTextTextTextTextText Text Text Text Text Text Text Text Text }}\\ \hline
\label{que:1} & A & Do you think ...? & This is a good question.\\
\label{que:2} & C & Do you feel Text & This is a good question.\\
\label{que:3} & E & What do you think of your previous boss & Relationship between employee and employer text Text textText text Text text Text text.\\ \hline
\multicolumn{4}{|c|}{Interview phase 2}\\ \hline
\multicolumn{4}{|C{17.5cm}|}{\textit{Text This phase focus on ... }}\\ \hline
\label{que:4} & D & Is this ...? & Good question.\\
\label{que:5} & I & Do you like Text & A good question.\\
\label{que:6} & A & what do you think of your mother & Relationship \\ \hline
\caption {Questions and explanation} \label{tab:interviewspg}
\end{longtable}
\end{center}
\prepareresultsections
\resultsection{Interview answers person \theinterviewee}
The following section contains the answers from interviewperson \theinterviewee
\begin{center}
\begin{longtable}{|N| V{8.3cm} | V{8.3cm} |}
\hline
\multicolumn{1}{|c}{} & \multicolumn{1}{c|}{\textbf{Question}} & \multicolumn{1}{c|}{\textbf{Answer}} \\ \hline
\label{QA:1} & Do you think ...? & Yes I think.\\
\label{QA:2} & Do you feel Text & I feel a lot of text.\\
\label{QA:3} & What do you think of your previous boss & I hated him.\\
\multicolumn{1}{|c|}{\subquest\therowcntr\label{QA:3a}} & \textbf{This is an unexpected follow up question} \textbf{Why did you hate him?} & \textbf{Because he was evil.}\\
\label{QA:4} & Is this ...? & Yes\\
\label{QA:5} & Do you like Text & Text is good.\\
\label{QA6:6} & what do you think of your mother & I really like my mother \\ \hline
\caption {Questions and answers} \label{tab:interviewspgA}
\end{longtable}
\end{center}
\resultsection{Interview answers person \theinterviewee}
The following section contains the answers from interviewperson \theinterviewee
\begin{center}
\begin{longtable}{|N| V{8.3cm} | V{8.3cm} |}
\hline
\multicolumn{1}{|c}{} & \multicolumn{1}{c|}{\textbf{Question}} & \multicolumn{1}{c|}{\textbf{Answer}} \\ \hline
\label{QB:1} & Do you think ...? & No\\
\label{QB:2} & Do you feel Text & No you can't feel text\\
\label{QB:3} & What do you think of your previous boss & She was okay\\
\label{QB:4} & Is this ...? & No\\
\label{QB:5} & Do you like Text & Text is bad.\\
\label{QB:6} & what do you think of your mother & I would like to not answer that \\ \hline
\caption {Questions and answers} \label{tab:interviewspgB}
\end{longtable}
\end{center}
\end{document}
更好的方法需要更多的信息和更彻底的设计,就目前而言,所需的特性尚未明确表述。