2

I need merging several research papers compiled using CAS-DC Elsevier template in single .pdf file with bibliography in each research paper and consecutive page numbering across the whole .pdf document. Minimal Working Example at: I need merging several research papers in single .pdf file

I tried confproc, combine, pdfpages and subfiles, docmute packages. Regardless package while compiling main document I always see the same error:

! LaTeX Error: Control sequence \sep: already defined.

In compiled main document I see repetition of Title, Authors, Affilations etc. For instance: In main file in second research paper there are Title, Authors, Affilations, e-mails ORCID etc. from first research paper etc.

It is not about Concatenating I need problem resolution by means of LaTex (MiKTeX, TeXstudio).

All your suggestions will be appreciated. Thank your in advance.

9
  • \sep is defined more than once via packages and/or class(es). So take them out one by one. // However, in your subfile the class you need to specify is NOT „subfile“, but „main“ or „../main“ etc. in your case.
    – MS-SPO
    Oct 31, 2023 at 8:37
  • Thank you for your suggestion. If I try subfiles package in subfile I specify: \documentclass[../main.tex]{subfiles} or \documentclass[document]{subfiles} If I try standalone package in subfile I specify: \documentclass[class=article, crop=false]{standalone} \usepackage[subpreambles=true]{standalone} and so on according package specification (docmute, combine) and even I try \include or \input command without use any multifile package the problem is the same: \sep is defined and in compiled single pdf I see repetition of Titles, Authors and Affiliations Oct 31, 2023 at 9:15
  • Now instead of long preamble I use my own style file including all necessary packages. I verified my style file but it does not contain any \sep If I take out any package from my style file it means I will lose some style file functionality. How to resolve this issue? Thank you in advance. Oct 31, 2023 at 9:15
  • 1
    Many thanks. “(I'm sure you work on a copy for this analysis, do you?)” Yes, of cause. Thank you for your suggestion I will Focus on creating the \sep messages Oct 31, 2023 at 9:35
  • 1
    @AndriyBublikov, I suggest to use my findings below and prepare 3 very short files, main.tex, sub1.tex and sub2.tex, where the sub-files basically only contain the keyword environment. With about 10-20 lines of code per file, which all do compile, the problem will be easier to see. I.e. discard almost all packages and embellishments, just focus on the problem, arising from a second use of the keyword’s environment. May be as P.S. to your question, or perhaps as a new one.
    – MS-SPO
    Nov 1, 2023 at 3:10

2 Answers 2

1

The definition of the keywords environment in cas-common.sty is

\NewDocumentEnvironment { keywords } { O{ Keywords } }
   {
     \tex_global:D \tex_setbox:D \g_stm_key_box = \vtop \bgroup
     \hsize=.25 \textwidth
     \cs_new:Nn \sep: { \par }
     \cs_set_eq:NN \sep \sep:
     \parindent \z@
     A\,R\,T\,I\,C\,L\,E\ \ I\,N\,F\,O \par \skip_vertical:n { -3pt }
     \rule{.25 \textwidth}{.2pt}\par\footnotesize
     \noindent \textit { #1 }:  \par
   }
   { \egroup }

It is difficult to say anything friendly about this code, this is a sort of tex-latex-expl3 pidgin.

In any case the problem is from the (useless) \cs_new:Nn. One should never use this command in environment definitions.

You can avoid the error by redefining the environment (this doesn't make it much nicer, it only avoids the error):

\documentclass[a4paper,fleqn,twoside]{cas-dc}

\ExplSyntaxOn\makeatletter
\RenewDocumentEnvironment { keywords } { O{ Keywords } }
   {
     \tex_global:D \tex_setbox:D \g_stm_key_box = \vtop \bgroup
     \hsize=.25 \textwidth
     %\cs_new:Nn \sep: { \par } % removed
     \def\sep{\par}             % \cs_set_eq:NN \sep \sep:
     \parindent \z@
     A\,R\,T\,I\,C\,L\,E\ \ I\,N\,F\,O \par \skip_vertical:n { -3pt }
     \rule{.25 \textwidth}{.2pt}\par\footnotesize
     \noindent \textit { #1 }:  \par
   }
   { \egroup }

\ExplSyntaxOff\makeatother
6
  • Thank you very much for your supporting. I accept any paccage allowing me problem resolution. Thank you for your code. Yes, you are right. The error desapeared but the problem of \maketitle (repetition of Authors Affilations) not. I have tried cofproc package there are no such problems. However, there is another problem: cofproc package invoke opening subdocuments. Is it possible to prevent cofproc package from opening subdocuments? Nov 2, 2023 at 12:15
  • your question here was about the error. If you have a new problem ask a new problem (and this time with a proper example document, I only could answer here because the other answer take the trouble to provide some test code) Nov 2, 2023 at 12:27
  • Thank you very much for your supporting. Thank you for your code. Yes, you are right. The error desapeared but the problem of \maketitle (repetition of Authors Affilations) not. I accept any approch any paccage allowing me problem resolution. I have tried cofproc package there are no such problems. However, there is another problem: cofproc package invoke opening subdocuments. tex.stackexchange.com/questions/700219/… Nov 2, 2023 at 13:08
  • As David wrote your other question is not understandable. Improve it. Add code that one can test and that demonstrates the problem. Nov 2, 2023 at 13:12
  • For merging I tried next approaches: 1) Concatenating these approaches resolve merging problem. However, in my subdocuments there are a lot of cross-references and backreferences (bibliography, footnotes, etc.), using PDF-XChange Editor and Adobe Acrobat DC Pro I have to remake them manually. It takes a lot of time. 2) simple including and inputting; 3) docmute, combine, standalone, subfiles. Nov 2, 2023 at 14:44
0

Ok, here's a preliminary result of my analysis.

1st approach

Objective: make your files compile.

While doing so, my MikTeX console asked for a number of missing files to be installed, including the cas-dc.cls .

With the changes marked as % <<< !! I finally could make main.tex compile (with only the first subfile() call active). After changing sub1.tex as mentioned, both files compile separately, as they should.

Though there were warnings, the \sep error did not show up.

main.tex:

% 
% 

\documentclass[a4paper,fleqn,twoside]{cas-dc}
\usepackage{subfiles}

\usepackage[numbers]{natbib}

\usepackage[T1,T2A]{fontenc}
\usepackage[utf8,]{inputenc}
%\usepackage{tempora}
%\usepackage{XCharter}
\usepackage{textcomp}
\usepackage[russian,ukrainian,romanian,english]{babel}
%\usepackage[dvipsnames,x11names]{xcolor}
\renewcommand{\rmdefault}{ftm}
\usepackage{yfonts}
\usepackage{multicol}

\usepackage{lineno,hyperref}
%\modulolinenumbers[5]
\usepackage{amsmath,amsfonts,amssymb,amsthm,mathtools,enumerate,float}

\sloppy

\makeatletter
\def\ps@first{%
\let\@oddhead\@empty
\let\@evenhead\@empty
\def\@oddfoot{}
\let\@evenfoot\@oddfoot
}

\usepackage{wrapfig}
\usepackage{graphicx}
\renewcommand{\rmdefault}{cmr}
\renewcommand{\sfdefault}{cmss}
\renewcommand{\ttdefault}{cmtt}
%\renewcommand{\rmdefault}{cmss}
\renewcommand{\ttdefault}{cmss}


%\DeclareFontSubstitution{T2A}{cmr}{m}{n}
%\DeclareSymbolFont{T2Aletters}{T2A}{cmr}{m}{it}
\usepackage{geometry}
\renewcommand{\theenumi}{\arabic{enumi}}% Меняем везде перечисления на цифра.цифра
\renewcommand{\labelenumi}{\arabic{enumi}}% Меняем везде перечисления на цифра.цифра
\renewcommand{\theenumii}{.\arabic{enumii}}% Меняем везде перечисления на цифра.цифра
\renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}.}% Меняем везде перечисления на цифра.цифра
\renewcommand{\theenumiii}{.\arabic{enumiii}}% Меняем везде перечисления на цифра.цифра
\renewcommand{\labelenumiii}{\arabic{enumi}.\arabic{enumii}.\arabic{enumiii}.}% Меняем везде перечисления на цифра.цифра

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[CO]{ }
%\fancyhead[LO] {}
\fancyhead[CE]{ }
%\fancyhead[RE] { }
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}

\fancyfoot[C]{}%}}  % <<< !!

{
\fancyfootoffset[R]{-12cm}
\fancyfoot[L]{}
\fancyfoot[C]{}
\fancyfoot[R]{}
\renewcommand{\footrulewidth}{0.3 mm}
\renewcommand{\headrulewidth}{0.3 mm}
}
\setlength{\voffset}{-10mm}
\setlength{\topmargin}{0mm}
\setlength{\headheight}{5mm}
\setlength{\headsep}{5mm}
\setlength{\footskip}{6mm}


%\newcommand{\l@abcd}[2]{\hbox to\textwidth{#1\dotfill #2}}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\BR@backref}{\newblock}{\newblock(page~}{}{}
\patchcmd{\BR@backref}{\par}{)\par}{}{}
\makeatother

\usepackage[]{notes2bib}
\usepackage[nottoc]{tocbibind}

\usepackage[colorlinks]{hyperref}
%\hypersetup{pdffitwindow=true,linkcolor=LightSkyBlue,citecolor=Sienna,urlcolor=Navy,menucolor=black}
\hypersetup{
colorlinks=true,
linkcolor=magenta,
filecolor=blue,
urlcolor=blue,
citecolor=green,
anchorcolor=blue,
menucolor=blue,
backref=false,
backref=page,
pdfpagemode=UseNone,
pdfstartview=}
\RequirePackage[hyperpageref]{backref} 
\renewcommand*{\backref}[1]{}  
\renewcommand*{\backrefalt}[4]{
\ifcase #1 
No cited.
\or
Cited on page #2.
\else
Cited on pages #2.
\fi}


\begin{document}

\subfile{sub1} % <<< !!

\subfile{sub2} % <<< !! (not used in 1st approach)

\end{document}

sub1.tex, wiht some parts missing (image) or obscure (\maketitle):

%\documentclass[document]{subfiles}
\documentclass[main]{subfiles} % <<< !!

\begin{document}

\title [mode = title]{ }

\tnotemark[1]
\tnotetext[1]{Research Paper}
\tnotetext[1]{This document is the result of blood, sweat, tears and taxpayer money.}
\nonumnote{This note has no numbers. In this work we demonstrate $a_b$
the formation Y\_1 of a new type of polariton on the interface
between a cuprous oxide slab and a polystyrene micro-sphere placed
on the slab.}

\credit{Conceptualization of this study, Methodology, Software}


\author[2]{ }
[orcid=https://orcid.org/]
\cormark[2]
\fnmark[2]
\fntext[fn2]{ }

\ead{[email protected]}
\ead[URL]{www. }%

% Address/affiliation
\affiliation[2]{organization={National Scientific Center «Hon. Prof. M. S. Bokarius Forensic Science Institute»},
addressline={ },
city={ },
country={ }}
\credit{ }

\begin{abstract}
Abstract Text
\end{abstract}

\begin{keywords}
keywords
\vspace*{0.5\baselineskip}
\textbf{Article history:}\\ Received: 30.09.2021\\ Received in revised form: 19.12.2021 \\Accepted: 9.01.2022 \\Available online: 11.01.2022
\end{keywords}

%\maketitle % <<< !!


\section{ }
Text

\section{ }
text
\section{ } 
Text
\section{Conclusions} 
Text 

\section{Conclusions} 

Text 
\subsection{Acknowledgements} 

Text 

%\bio{{figs/image1}} % <<< !!
Author biography with author photo.
%\end{multicols} % <<< !!
\end{document}

2nd approach

How to provoke \sep errors ? Let's try including a second file:

  • including sub1.tex did it (!)
  • modifying sub1.tex into a slightly changed sub2.tex did it (!)

Note:

  • with two different subfiles included in main

  • sub1 went smoothly,

  • while sub2 cause your error when compiling main.tex

    ! LaTeX Error: Control sequence \sep: already defined. For immediate help type H . ... l.44 \end {keywords}

So, where is it?

I proved by:

  • commenting out the whole keyword environment (no error)
  • allowing only the \begin \end statements (error)

it's here:

% <<< !!!
\begin{keywords}
%keywords
%\vspace*{0.5\baselineskip}
%\textbf{Article history:}\\ Received: 30.09.2021\\ Received in revised form: 19.12.2021 \\Accepted: 9.01.2022 \\Available online: 11.01.2022
\end{keywords}

You probably need to \renewenvironment the keyword environment, or a similar action.

Conclusion

In this case a stepwise enhancement of code was sufficient to cause the error. Reading the error message made it simple to localize the trouble maker: an environment.

Maybe somebody who knows the cas-dc.cls class by heart has a cure for you.

However, some work is left to do, like adjusting the counters, as the main.pdf generated without the trouble maker shows:

main.pdf

3
  • Dear MS-SPO, Thank you for your work and your explanation. In my turn, I verified my style file, found some repeated package and deleted them. But \sep error has not disappeared. I knew that problem is in keywords environment I read the error message: “ For immediate help type H <return>. ... l.201 l egislation on occupational and life safety, normative regulation, nor... This is a coding error. LaTeX has been asked to create a new control sequence '\sep:' but this name has already been used elsewhere. The current meaning is: \long macro:->\par” Oct 31, 2023 at 19:45
  • However I do not understand how to get rid of this error. I do not understand where “\sep:' but this name has already been used elsewhere” As I wrote deleted unnecessary package in my style file. Oct 31, 2023 at 19:45
  • @AndriyBublikov: Time for the cas-dc-gurus: "Maybe somebody who knows the cas-dc.cls class by heart has a cure for you." // BTW, trouble probably happens between lines 1612 and 1623 or cas-common.sty ... and it may be, this template doesn't allow the approach you're after. // Just wait for the more experienced users here.
    – MS-SPO
    Oct 31, 2023 at 21:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .