Create a configured LaTeX manuscript folder with scikit-package
Overview
This is a tutorial for using scikit-package
to create a configured manuscript folder by running the command
package create manuscript
We strongly recommend that you read through (Recommended) Customize the your LaTeX repositories to unleash the full potential of creating a manuscript folder with scikit-package
.
Prerequisites
To proceed with the following steps, we assume that you
know how to use
conda
to create an environment and installscikit-package
in the environment. Please see (Required) Use conda environment to install packages and run Python code for more information.(Optional) know how to manage repositories on GitHub. Please see the GitHub tutorial GitHub Hello World for more information.
Create a manuscript folder with minimum setup.
Create a
conda
environment withscikit-package
installed and activate the environment. Please see (Required) Use conda environment to install packages and run Python code for more information.conda create -n <project-name>-env scikit-package conda activate <project-name>-env
Go to the path where the manuscript folder will be created.
cd <manuscript-folder-parent-folder>
Run the command.
package create manuscript
Answer the following questions:
Prompt
Description and example
project_name
The name displayed in the
README.rst
. Usename-with-hyphens
e.g.,my-manuscript
.journal_template
Specifies which journal template to use to create the manuscript. The default value is
[1]
, which corresponds to thearticle
template.user_latex_repo_url
The URL to the GitHub repository where the LaTeX files are located. Files with the specified names will be parsed, and the other files will be copied directly into the manuscript folder. e.g.,
https://github.com/scikit-package/default-latex-headers.git
Note
You may press the “Enter” key to accept the default values for the questions.
Done! A manuscript folder named
<project_name>
is created inside<manuscript-folder-parent-folder>
.
(Recommended) Customize the your LaTeX repositories
The flexibility of using package create manuscript
to create a manuscript folder is the ability to customize LaTeX repositories for different manuscripts. The following steps will help you create a LaTeX repository to be used by package create manuscript
.
Example
Create a GitHub repository. Please see Create a new GitHub repository for more information. As an example, set
Repository name
to bemy-latex-repo-example
, choose the visibility to bepublic
, and selectNone
for.gitignore
andlicense
. You will be directed to themy-latex-repo-example
page in GitHub after it is created.Find the
Quick setup
section in themy-latex-repo-example
page, choose theHTTPS
option and copy the URL in the section. The URL will be referred to as<copied-my-latex-repo-example-url>
in the following steps.Open the terminal and clone the
my-latex-repo-example
repository. After the command, amy-latex-repo-example
folder will be created locally.cd ~ git clone <copied-my-latex-repo-example-url>
Create
usepackages.txt
andnewcommands.txt
inside the~/my-latex-repo-example
directory.usepackages.txt
is used to import packages using\usepackage{graphicx}
into the main LaTeX file.newcommands.txt
is used to add commands like\newcommand{\a_command}[1]{\mathrm{#1}}
into the main LaTeX file. The main LaTeX file ismanuscript.tex
in the manuscript folder by default.Note
No LaTeX syntax check is executed during
package create manuscript
. The content inusepackages.txt
will be inserted after\documentclass
and the content innewcommands.txt
will be inserted after all\usepackage
commands.Example of
usepackages.txt
\usepackage{mathtools} \usepackage{amsmath} \usepackage{mathtools} ...
Example of
newcommands.txt
\newcommand{\command_1}[1]{\mathrm{#1}} \newcommand{\command_2}[1]{\mathbb{#1}} \newcommand{\command_3}[1]{\mathcal{#1}} ...
You can also add any additional files inside the
~/my-latex-repo-example
folder. These are the files that will be copied directly into the manuscript folder. e.g.cd ~/my-latex-repo-example touch my-class-file.cls touch my-style-file.sty touch my-bib-file.bib
Commit the change and sync the
my-latex-repo-example
repository in GitHub.git add . git commit -m 'skpkg: initialize a LaTeX repository' git push origin main
Done! To test it, go to the path where a manuscript folder will be created and run
package create manuscript
with<copied-my-latex-example-url>
as the input for<user_latex_repo_url>
.mkdir ~/my-manuscripts cd ~/my-manuscripts package create manuscript
A manuscript folder will be created in the ~/my-manuscripts
. Files from the my-latex-repo-example
GitHub repo will be copied into the manuscript folder. Packages and commands in usepackages.txt
and newcommands.txt
will be inserted after \documentclass
in the main LaTeX file (manuscript.tex
by default) in the manuscript folder. The names of all .bib
will be added to the \bibliography
entry in the main LaTeX file.
In this example, we used a GitHub repository named my-latex-repo-example
to store the LaTeX files. The repository is maintained locally in ~/my-latex-repo-example
and five files my-class-file.cls
, my-style-file.sty
, my-bib-file.bib
, usepackages.txt
and newcommands.txt
are created inside my-latex-repo-example
. The name for the repository and its local location can be chosen freely. You can also add, remove, or modify any files in that repository.
Want a new manuscript template?
Feel free to contribute it! You are welcome to create issues and PRs in scikit-package-manuscript.