0

Im doing a paper where I have the main.tex with the content of the entire paper and I want to insert another .tex with my abstract within the main.tex. The abstract has its own .cls with code for the setup. How do I do this?

I have tried to use \include and \import but it doesn't seem to work. I have tried making a folder with the abstract.tex and its .cls and then import the abstract.tex to the main. It only gives me the text content of the abstract and not the setup.

The template for the abstract and .cls is one from overleaf: WPCCG - Abstract - Template - Final Version

Can anyone tell me how to insert the abstract in my main.tex with its own setup? If there is an easier way of doing this I am all ears.

7
  • 1
    Check out standalone package.
    – user202729
    Dec 24, 2021 at 10:53
  • Although depends on the exact content it might not be impossible (for example if the abstract file defines some specific macro in the preamble). ■ Without more specific details it's impossible for us to help (for example why can't you just copy the TeX code in the abstract into the preamble? Or make a separate file with only the body then \input that one?)
    – user202729
    Dec 24, 2021 at 10:54
  • 1
    surely the text of an abstract is not so complicated to require a separate class!!! Just set the text with the class for your main document. Dec 24, 2021 at 11:21
  • Which class uses your main article? Dec 24, 2021 at 13:27
  • Im new at this so i will try and post some code.
    – Danielle
    Dec 28, 2021 at 16:26

1 Answer 1

1

The template you mention (WPCCG - Abstract - Template - Final Version) will produce not only the abstract, but also the title, authors, affiliations, ... that's the first page of an article, using the elsarticle class.

The template sets the margins using the geometry package with these settings

\usepackage[left=2.5cm, right=2.5cm, top=4cm, bottom=3cm, footskip=0.5cm]{geometry}

Option 1

If you produced your main.tex article with another class a procedure would be:

  1. Compile FirstPage.tex to produce FirstPage.pdf in same directory of main.tex, where FirstPage.tex is the template file with your own inputs.
  2. Add the first page using includepdf[pages=1]{FirstPage.pdf} . Requires the package pdfpages.

Important: You must use the same geometry settings in both files.

Note that the "abstract" generated is to submit a conference paper and does not follow the standard format used in journal articles: to begin with, the title Abstract is missing (See figure of option 2)

a

This is an example of main.tex.

\documentclass[12pt,a4paper]{article}

%%%margin settings >>>    THE SAME of FirstPage.tex
\usepackage[left=2.5cm, right=2.5cm, top=4cm, bottom=3cm, footskip=0.5cm]{geometry}

\usepackage{kantlipsum} % dummy text
\usepackage{showframe} % show margins

\usepackage[final]{pdfpages}% added <<<<<<<<<<<<<<<<<<<
\begin{document}
    
    \includepdf[pages=1]{FirstPage.pdf}% add the first page with title and abstract <<<<<<<<<<<<<<<<
    
    \section{Introduction}
    \kant[1]
    
    \section{The work done}
    \kant[2]
    
\end{document}

Option 2: write your article using elsarticle

b

\documentclass[preprint,12pt]{elsarticle}

\usepackage{amssymb}

\journal{Nuclear Physics B}

\begin{document}

\begin{frontmatter}

\title{Title of Your Manuscript}

\author[inst1]{Author One}

\affiliation[inst1]{organization={Department One},%Department and Organization
            addressline={Address One}, 
            city={City One},
            postcode={00000}, 
            state={State One},
            country={Country One}}

\author[inst2]{Author Two}
\author[inst1,inst2]{Author Three}

\affiliation[inst2]{organization={Department Two},%Department and Organization
            addressline={Address Two}, 
            city={City Two},
            postcode={22222}, 
            state={State Two},
            country={Country Two}}

\begin{abstract}
%% Text of abstract
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{abstract}
\begin{keyword}

keyword one \sep keyword two
\PACS 0000 \sep 1111
\MSC 0000 \sep 1111
\end{keyword}

\end{frontmatter}


%% main text
\section{Sample Section Title}
\label{sec:sample1}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit  anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum see appendix~\ref{sec:sample:appendix}.

\appendix

\section{Sample Appendix Section}
\label{sec:sample:appendix}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor section \ref{sec:sample1} incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.