테이블의 줄 번호 참조

테이블의 줄 번호 참조

내 학생 중 한 명이 인터뷰를 준비해야 합니다. 그녀는 인터뷰한 많은 사람들로부터 답변을 얻었으며, 이는 전체 인용문으로 인쇄될 것입니다. 그녀의 임무는 답변을 분석하고 일종의 요약을 제공하는 것입니다. 따라서 답변에는 참조할 수 있는 줄 번호가 제공되어야 합니다.

package 를 활성화하려고 했지만 lineno레이블이 테이블 형식 내에서 작동하도록 만들 수 없었습니다.

보시다시피 인용된 답변에 줄 번호를 인쇄하고 분석을 위해 줄 번호를 끌 수 있었습니다.

테이블에 여러 줄의 조판 텍스트를 표시하도록 MWE를 업데이트했습니다.

\documentclass[%
   a4paper,
   11pt,
   twoside,
   parskip=half,
   english,
]{scrartcl}

%%% ------------------------------------------------------ &Packages ---
\usepackage{babel}                      % Language selection
\usepackage[T1]{fontenc}                % Output font encoding
\usepackage[newcommands]{ragged2e}      % Hyphenation in ragged modes
\usepackage[running]{lineno}            % Package for line numbers
\usepackage{array}                      % Improved tabular macros
\usepackage{xltabular}                  % X-Column and longtables altogether 
\usepackage{booktabs}                   % Nicer table lines

  

%%% --------------------------------------------------- &Definitions ---
%%% Some useful definitions . . .

%% Neuer Spaltentyp L für linksbündigen Flattersatz mit variabler
%% Breite (#1).  
\newcolumntype{L}[1]{ >{\nolinenumbers\raggedright\hspace{0pt}\arraybackslash} p{#1} }

%% Und noch mal, aber auf Basis der X-Spalte
\newcolumntype{Y}{
  >{\internallinenumbers\raggedright\hspace{0pt}\arraybackslash}
  X
  <{\nolinenumbers}
}

%% Und eine Definition für die Spaltenüberschriften
\newcolumntype{H}{ >{\footnotesize} c }


%% Neues Makro mit dem die Antwort eingegeben wird.
\newcommand{\answer}[1]{%
    \begin{linenumbers}%
      % \begin{numquote}%
      #1%
      % \end{numquote}%
    \end{linenumbers}%
}

%% Und zwei Befehle, um die referenzierte Zeilennummer zu markieren
%% bzw. zu referenzieren.
\newcommand{\imark}[1]{\linelabel{answer:#1}}
\newcommand{\iref}[1]{line~\ref{answer:#1}}
\newcommand{\iregion}[2]{%
  Zeilen~\ref{answer:#1}--\ref{answer:#2}%
}




%%% ====================================================== &Document ===
\begin{document}

%% This works
\begin{linenumbers}
  The sun\imark{sun} was shining the whole day.
\end{linenumbers}
In \iref{sun} she speaks of weather.

%% This works also
\answer{The sun didn't shine for month.  It was dark\imark{dark} and
  cold.}
In \iref{dark} temperatures are mentioned.

\begin{tabularx}{\linewidth}{@{} Y L{.3\textwidth} @{}}
  \toprule
  \multicolumn{1}{@{} H}{Answer}
  & \multicolumn{1}{H @{}}{Explanation} \\
  \midrule
  %% Numbers printed, reference undefined, no error messages
  \answer{The sun\imark{sun2} was shining the whole day.  
  But from time\iref{time} to time, it also rained, which poduced 
  beautiful rainbows\ilabel{rainbow} in the otherwise clear blue
  sky.\ilabel{sky}}
  & In \iref{sun2} she speaks of weather.\newline
    In \iregion{time}{sky} something other is discussed.\\
  % %% Error message: "\linelabel without \linenumbers".
  % The sun\imark{sun3} was shining the whole day.
  % & In \iref{sun3} she speaks of weather.\\
  \bottomrule
\end{tabularx}

\end{document}

표 형식 내에서 줄 번호를 저장/검색하는 비결은 무엇입니까?

답변1

를 이용한 더러운 속임수는 어떻습니까 paracol?

\documentclass[%
   a4paper,
   11pt,
   twoside,
   parskip=half,
   english,
]{scrartcl}
\usepackage{showframe}
%%% ------------------------------------------------------ &Packages ---
\usepackage{babel}                      % Language selection
\usepackage[T1]{fontenc}                % Output font encoding
\usepackage[newcommands]{ragged2e}      % Hyphenation in ragged modes
\usepackage[running]{lineno}            % Package for line numbers
\usepackage{array}                      % Improved tabular macros
\usepackage{xltabular}                  % X-Column and longtables altogether 
\usepackage{booktabs}                   % Nicer table lines
\usepackage{paracol}
\columnratio{0.7}
  

%%% --------------------------------------------------- &Definitions ---
%%% Some useful definitions . . .

%% Neuer Spaltentyp L für linksbündigen Flattersatz mit variabler
%% Breite (#1).  
\newcolumntype{L}[1]{ >{\nolinenumbers\raggedright\hspace{0pt}\arraybackslash} p{#1} }

%% Und noch mal, aber auf Basis der X-Spalte
\newcolumntype{Y}{
  >{\internallinenumbers\raggedright\hspace{0pt}\arraybackslash}
  X
  <{\nolinenumbers}
}

%% Und eine Definition für die Spaltenüberschriften
\newcolumntype{H}{ >{\footnotesize} c }


%% Neues Makro mit dem die Antwort eingegeben wird.
\newcommand{\answer}[1]{%
    \begin{linenumbers}%
      % \begin{numquote}%
      #1%
      % \end{numquote}%
    \end{linenumbers}%
}

%% Und zwei Befehle, um die referenzierte Zeilennummer zu markieren
%% bzw. zu referenzieren.
\newcommand{\imark}[1]{\linelabel{answer:#1}}
\newcommand{\iref}[1]{line~\ref{answer:#1}}
\newcommand{\iregion}[2]{%
  Zeilen~\ref{answer:#1}--\ref{answer:#2}%
}




%%% ====================================================== &Document ===
\begin{document}

%% This works
\begin{linenumbers}
  The sun\imark{sun} was shining the whole day.
\end{linenumbers}
In \iref{sun} she speaks of weather.

%% This works also
\answer{The sun didn't shine for month.  It was dark\imark{dark} and
  cold.}
In \iref{dark} temperatures are mentioned.

\begin{tabularx}{\linewidth}{@{}>{\footnotesize\centering\arraybackslash}p{.7\linewidth} >{\footnotesize\centering\arraybackslash}X@{}}
  \toprule
  Answer
  & Explanation \\
  \midrule
\end{tabularx}
\begin{sloppypar}
\begin{paracol}{2} 
  \answer{The sun\imark{sun2} was shining the whole day.  
  But from time\imark{time} to time, it also rained, which produced 
  beautiful rainbows\imark{rainbow} in the otherwise clear blue
  sky.\imark{sky}}
  \switchcolumn
  In sun: \iref{sun2} she speaks of weather.\newline
  Rainbows: \iref{rainbow}.\newline
  In time: \iref{time}, sky: \iref{sky} something other is discussed.
\end{paracol}
\begin{paracol}{2} 
  \answer{The sun\imark{sun3} was shining the whole day.  
  But from time\imark{time3} to time, it also rained, which produced 
  beautiful rainbows\imark{rainbow3} in the otherwise clear blue
  sky.\imark{sky3}}
  \switchcolumn
  In sun: \iref{sun3} she speaks of weather.\newline
  Rainbows: \iref{rainbow3}.\newline
  In time: \iref{time3}, sky: \iref{sky3} something other is discussed.
\end{paracol}
\end{sloppypar}\vspace{-8pt}
\begin{tabularx}{\linewidth}{@{}X@{}}
  \bottomrule
\end{tabularx}

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보