Code Monkey home page Code Monkey logo

generator-latex's Introduction

LaTeX

Generator LaTeX

Latest Release Build Status Yeoman

Getting Started

What is Yeoman?

Trick question. It's not a thing. It's this guy! Take a look at yeoman.io.

What will be created?

Structure

This generator will be perfect for every type of LaTeX document. It helps you to create a solid structure of your project.

Take a look at this final structure:

│- .editorconfig
│- Gruntfile.js        # The compilator launcher file
│- main.tex            # The global file
│- package.json
│
└── src
    │- glos.tex        # The glossary file
    │- refs.bib        # The reference file
    │- ...
    │
    └── 1
        │- main.tex    # First chapter global file
        │- ...

    └── 2
        │- main.tex    # Second chapter global file
        │- ...

    └── ...

└── dist
    │- [PROJECT].pdf   # The final PDF file output
    │- ...             # Some files used for compilation

Tools

It import for you some tools, with their own features such as:

  • Grunt engine, for easy tasks running and managing.
  • Complete and structured compilation command without opening terminal.
  • Automatic compilation at file changes.
  • Full and automatic PDF view in your browser.

After generation, keeping your work up-to-date during your writting is easy:

$ grunt

That's it! ✨

Can I test compilation?

Yes! The generator will create a compatible project for LaTeX CI builds, without any configuration.

For CI Server, see for example ShareLaTeX.

Generator Usage

Create the LaTeX project

Yeoman travels light. He didn't pack any generators when he moved in. You can think of a generator like a plug-in. You get to choose what type of application you wish to create, such as a Backbone application or even a Chrome extension.

To install generator-latex from npm, run:

$ npm install -g generator-latex

Finally, initiate the generator:

$ yo latex

Chapter Sub-Generator

Adding a chapter is a repetitive task. To keep them organized, the Chapter Sub-Generator creates a chapters directory, and lets you create sub-directories for each chapter.

To run it:

$ yo latex:chapter

or directly to bypass questions:

$ yo latex:chapter 1 Introduction

Will create src/1/main.tex.
The title of this chapter will be Introduction.

It also adds to ./main.tex, inserting an \include just before it sees % End of chapter files listing.

Regarding glossary

In order for the glossary generation to work, you need to ensure the makeglossaries command is available system-wide.

A quick way to check if the command is available is to invoke it from any terminal.

makeglossaries

On Windows, it is mandatory to add the folder C:\\...\MiKteX X.X\miktex\bin to the PATH, otherwise the command will not be available.

Latex code sample to insert a glossary entry:

\gls{computer}

Regarding graphics

Figures in svg format can be automatically converted to pdf upon changes. This provides a robust and easy way to import vector graphics in latex.

A specific grunt task can be run to refresh all figures, although the grunt command will start by regenerating all figures.

grunt execute:figs

Latex code sample to insert a .pdf graphic generated from .svg:

\begin{figure}[h]
  \centering
  \includegraphics{src/foobar.pdf}
  \caption{Figure example of an imported pdf generated from an svg file (drawn with inkscape)}
  \label{figure_example}
\end{figure}

Regarding bibliography

When the bibliography is modified, it is properly reflected in the document two refresh later. This is due to how latex and bibtex interact. If you see some undefined references (displayed as [??]), simply let grunt perform a second refresh by modifying and saving any .tex file.

Latex code sample to insert a reference:

\cite{Perrin}.

License

MIT © Léo Colombaro

generator-latex's People

Contributors

greenkeeperio-bot avatar leocolomb avatar overdrivr avatar percipient24 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.