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
condato create an environment and installscikit-packagein 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
condaenvironment withscikit-packageinstalled 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-hyphense.g.,my-manuscript.journal_template
Specifies which journal template to use to create the manuscript. The default value is
[1], which corresponds to thearticletemplate.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.gitNote
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 nameto bemy-latex-repo-example, choose the visibility to bepublic, and selectNonefor.gitignoreandlicense. You will be directed to themy-latex-repo-examplepage in GitHub after it is created.Find the
Quick setupsection in themy-latex-repo-examplepage, choose theHTTPSoption 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-examplerepository. After the command, amy-latex-repo-examplefolder will be created locally.cd ~ git clone <copied-my-latex-repo-example-url>
Create
usepackages.txtandnewcommands.txtinside the~/my-latex-repo-exampledirectory.usepackages.txtis used to import packages using\usepackage{graphicx}into the main LaTeX file.newcommands.txtis used to add commands like\newcommand{\a_command}[1]{\mathrm{#1}}into the main LaTeX file. The main LaTeX file ismanuscript.texin the manuscript folder by default.Note
No LaTeX syntax check is executed during
package create manuscript. The content inusepackages.txtwill be inserted after\documentclassand the content innewcommands.txtwill be inserted after all\usepackagecommands.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-examplefolder. 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-examplerepository 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 manuscriptwith<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.