
회의를 위해 약 100개의 tex 파일을 처리해야 합니다. 각 파일에는 프레젠테이션 요약이 포함되어 있으며 작성자는 한 명입니다. 각 파일의 관련 부분이 다음 TeX 또는 LaTeX 매크로(명령 또는 환경)의 인수라고 가정해 보겠습니다.
TITLE
% 논문 제목
AUTHOR
% 작성자(다음과 같이 지정됨: LastName, FirstName)
AFFILIATION
저자의 소속 %(이메일 주소 포함)
ABSTRACT
% 프레젠테이션 요약
REFERENCES
%로 소개된 짧은 참고문헌 목록\bibitem
저자의 성(LastName)을 따라 정렬된 프레젠테이션 초록과 목차 및 소속을 포함하는 정렬된 참가자 목록이 포함된 문서를 얻고 싶습니다.
먼저 작성자가 제출한 tex 파일을 제거하고 관련 정보(위에서 언급한)만 남겨두려고 생각했지만 다음에는 "알고리즘" 방식으로(수동 정렬이나 기타 "수동 분류 없이") 어떻게 진행해야 할지 모르겠습니다. " 방법).
비슷한 질문을 살펴봤습니다.여기, 그러나 정렬 문제에 대한 해결책을 찾지 못했습니다.
답변1
그동안 정렬 부분을 제외하고는 부분적으로 문제를 해결했으며, 여러분의 소중한 의견과 제안을 기대하며 이를 여러분과 공유하려고 생각했습니다.
나는 "외부" 정렬을 선택하고 결과를 기본 tex 파일에 직접 붙여넣었습니다. 왜냐하면 이것이 가장 쉬운 옵션인 것 같기 때문입니다. 번들을 사용하려고 생각했지만 datatool
TeX 외부에서 간단한 텍스트 정렬을 사용하여 정렬하는 데 몇 초 밖에 걸리지 않았습니다.
데이터는 다음 구조의 간단한 텍스트 파일을 사용하여 작성자로부터 수집됩니다.
\AUTHOR{}{} %% <--- {LastName}{FirstName}
\EMAIL{}
\AFFILIATION{}
\TITLE{}
\ABSTRACT{}
기본 파일은 이러한 파일을 읽고 매크로가 외부 파일에 정의된 다음 최소 예(3개의 파일을 읽는 경우)에서와 같이 초록집의 내용을 생성합니다 abstractbook.sty
.
\documentclass[a4paper,12pt]{article}
\usepackage{abstractsbook}
\begin{document}
%% ++++++++++ Process submitted files ++++++++++++++++++
\begin{processfiles}
%% ---------------------------------------
\processfile{FirstAuthor}
\processfile{SecondAuthor}
\processfile{ThirdAuthor}
%% First sorted alphabetically outside TeX
\end{processfiles}
\parindent 0pt
%% +++++++++++++++++++ List of Talks ++++++++++++++++++
\listoftalks
%% +++++++++++++++++++ Abstracts ++++++++++++++++++++++
\abstracts
%% +++++++++++++++++++ Index of participants +++++++++++
\listofparticipants
%% +++++++++++++++++++++++++++++++++++++++++++++++++++++
\end{document}
파일 abstractbook.sty
은 위의 모든 매크로를 정의합니다. 파일을 처리할 때 기본 tex 파일과 동일한 폴더 \processfile{NameOfFile}
의 내용을 읽습니다 . NameOfFile.tex
각각은 \processfile{...}
로컬 카운터(읽은 파일 수 계산)를 늘리고 다음 매크로를 정의합니다.
\author-<x>-LastName
\author-<x>-FirstName
\affiliation-<x>
\email-<x>
\title-<x>
\abstract-<x>
<x>
카운터의 현재 값은 어디에 있습니까?
문서를 조판할 때 카운터의 모든 값을 순환하고 필요한 정보를 표시합니다.
에 대해서는 아래의 최소 예를 참조하세요 abstractbook.sty
. (그리 어렵지는 않지만) 읽을 수 있기를 바랍니다.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{abstractsbook}
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++
\RequirePackage{ifthen}
%% ----- some shortcuts ------
\let\ea=\expandafter
\let\cs=\csname
\let\ecs=\endcsname
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++
\newenvironment{processfiles}
{\newcount\numabs % <--- TeX local counter that counts
% the number of abstracts
\numabs=0\relax
\newcounter{numabs} % <--- LaTeX global counter
}
{\setcounter{numabs}{\the\numabs}
% < --- saving the final (local) value of \numabs
} % for global later use
\long\def\processfile #1{%
\advance\numabs by 1\relax
\input{#1.tex}
}%
\long\def\AUTHOR #1#2{%
\ea\long\ea\gdef\cs author-\the\numabs-LastName\ecs{#1}%
\ea\long\ea\gdef\cs author-\the\numabs-FirstName\ecs{#2}%
}
\long\def\AFFILIATION #1{%
\ea\long\ea\gdef\cs affiliation-\the\numabs\ecs{#1}
}
\long\def\EMAIL #1{%
\ea\long\ea\gdef\cs email-\the\numabs\ecs{#1}
}
%%
\long\def\TITLE #1{%
\ea\long\ea\gdef\cs title-\the\numabs\ecs{#1}
}
%%
\long\def\ABSTRACT #1{%
\ea\long\ea\gdef\cs abstract-\the\numabs\ecs{#1}
}
% ++++++++++++++ List of Talks ++++++++++++++++++++++++++++++++++++++++++++++
\def\heading #1{\cleardoublepage{\LARGE\scshape #1}\par\hrulefill\vskip 6ex}
\long\def\listoftalks
{
\heading{List of Talks}
\newcount\@i
\@i=1\relax
\whiledo{\the\@i<\numexpr \thenumabs+1\relax}
{\begin{minipage}{\textwidth}
\vskip 1.5ex
\leftskip 0em
\textsc{\cs author-\the\@i-FirstName\ecs}~\MakeUppercase{\cs author-\the\@i-LastName\ecs}
\par\leftskip 2.5em
\textit{\cs title-\the\@i\ecs}\dotfill\pageref{marker-\the\@i}
\end{minipage}
\advance \@i by 1\relax
}%
}
% ++++++++++++++ List of Participants +++++++++++++++++++++++++++++++++++++
\long\def\listofparticipants
{\heading{List of Participants}
\newcount\@i
\@i=1\relax
\whiledo{\the\@i<\numexpr \thenumabs+1\relax}
{\begin{minipage}{\textwidth}
\textbf{\MakeUppercase{\cs author-\the\@i-LastName\ecs}},~\textbf{\cs author-\the\@i-FirstName\ecs}
\vskip 1ex
\textit{\cs affiliation-\the\@i\ecs}
\vskip 0.25ex
\texttt{\cs email-\the\@i\ecs}
\end{minipage}
\vskip 4ex
\advance \@i by 1\relax
}%
}
% +++++++++++++++ Abstracts of Talks +++++++++++++++++++++++++++++++++++++++++
\long\def\abstracts
{\heading{Abstracts of Talks}
\newcount\@i
\@i=1\relax
\whiledo{\the\@i<\numexpr \thenumabs+1\relax}
{%
\begin{minipage}{\textwidth}
\label{marker-\the\@i} % <--- used for later referencing of the page
\begin{center}
\textsc{\Large \cs title-\the\@i\ecs}
\vskip 1.5ex
\textbf{\Large \cs author-\the\@i-FirstName\ecs~\cs author-\the\@i-LastName\ecs}
\vskip 1ex
\normalsize{\cs affiliation-\the\@i\ecs}
\end{center}
\vskip 2.5ex
\cs abstract-\the\@i\ecs
\end{minipage}
\vskip 8ex
\vfill
\advance \@i by 1\relax
}%
}
아래 추상 파일의 최소 예도 고려하십시오.
FirstAuthor.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\AUTHOR{First}{Author}% <--- {LastName}{FirstName}
%%
\EMAIL{[email protected]}
%%
\AFFILIATION{First University}
%%
\TITLE{The first title}
%%
\ABSTRACT{This is the abstract of the first talk.
And some math: $1+1=2$.
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SecondAuthor.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\AUTHOR{Second}{Author}% <--- {LastName}{FirstName}
%%
\EMAIL{[email protected]}
%%
\AFFILIATION{Second University}
%%
\TITLE{The second title}
%%
\ABSTRACT{This is the abstract of the second talk.
And some math:
\[
E=m\mathrm{c}^2.
\]}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ThirdAuthor.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\AUTHOR{Third}{Author}% <--- {LastName}{FirstName}
%%
\EMAIL{[email protected]}
%%
\AFFILIATION{Third University}
%%
\TITLE{The third title}
%%
\ABSTRACT{This is the abstract of the second talk.
And some math:
\[
\mathrm{e}^{i\pi}+1=0.
\]}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
이 최소 예제의 결과는 다음 파일입니다.