0

I made a customized document class called note and since I added a lot of additional features (e.g., fonts, tikz) so I feel that my file structure needs some modifications/improvements and I'd like some inputs.

Right now, my file strucute is as follows:

---- fonts
  |    |_ roman
  |    |_ mono
  |    |_ sans-serif
  |    |_ math
  |
  |- style
  |    |_ myfont.sty
  |    |_ mycolor.sty
  |    |_ ...
  |
  |- tikz
  |    |_ fig1.tex
  |    |_ fig2.tex
  |    |_ ...
  |    |_ mytikz.sty
  |
  |- figures
  |    |_ fig1.pdf
  |    |_ fig2.pdf
  |    |_ ...
  |
  |- notes
  |    |_ ch1.tex
  |    |_ ch2.tex
  |    |_ ...
  |
  |- main.tex
  |
  |- note.cls
  • fonts: directory storing fonts
  • style: directory storing multiple customized .sty files included by \usepackage in note.cls
  • tikz: directory storing tikz figure source code
  • figures: directory storing figures (including tikz figures in pdf) used in notes
  • note: directory storing multiple .tex files (note pages) included by \include in main.tex
  • main.tex: file includind all note pages
  • note.cls: file including all packages needed for the note class
3
  • Is this for a single document, or are you intending note.cls to be used for several different documents? If the latter, is there a partition between "files that will be used by several different documents" and "files needed just this time"? Commented Jun 16, 2023 at 1:54
  • This is for a single document but I'm thinking about creating individual tikz and figures directories for each chapter if the scale increases later on but I don't know if that is a good practice. Commented Jun 16, 2023 at 2:10
  • Welcome. // I‘d suggest two things: a) test how practical this structure is in a separate directory with dummy files, b) use the subfiles package. Perhaps having the pdfs of the tikz figures will better remain in /tikz, but try it out. With subfile you can compile each note separately wirh the preamble defined in your main document. // See its manual at packages.oth-regensburg.de/ctan/macros/latex/contrib/subfiles/… Commented Jun 16, 2023 at 3:56

1 Answer 1

0

Just to demonstrate the nice features of package subfiles, using a subset of your intended directory structure; this is only one way to do it:

Preparations

Create under your main directory directories figures, notes, style and tikz.

Store this as /figures/img.png:

img.png

Store this as /tikz/triag.tex:

\documentclass[10pt,border=0mm,tikz]{standalone}

\usepackage{tikz}

\begin{document}

 \begin{tikzpicture}
    \draw[fill=yellow!30!orange!50] (0,0) -- (2,0) -- (1,1) -- cycle;
 \end{tikzpicture}

\end{document}

Store this as /style/showme.sty: \newcommand\showme[1]{\textbf{++: #1 :++}}

Store this as main.tex:

\documentclass[10pt,a4paper]{article}
\usepackage{subfiles}% to ease your process
\usepackage{graphicx}% for figures

\include{style/showme.sty}% a simple style

\begin{document}
 Ok, this all goes to your main.tex.
 
    % you can build the \sections inside the notes ...
    \subfile{notes/ch2}% see /notes/ch2.tex
    
    % ... or explicitely here, whatever is more useful
    \section{This will be chapter 3}
\end{document}

Store this as /notes/ch2.tex:

\documentclass[../main]{subfiles}% reusing said preamble

% next, just build regular document content
\begin{document}

\section{This will be chapter 2}
 hello world.
 Including a .png image:
 \bigskip

 % displaying figures/img.png
 \includegraphics[scale=1]{figures/img} 
 \bigskip
 
 And now including the pdf from the tikz-directory:\bigskip
 
 % displaying tiks/triag.pdf
 \includegraphics[scale=1]{tikz/triag} 
 \bigskip
 
 % using self defined style, which is a simple macro here
 And here's something defined somewhere else \showme{as style}.
 
\end{document}

Some remarks

Using the standalone class for the tikz-drawings is useful, as it adjusts the "page size" as needed. You can include the generated pdf more easily later.

The preamble in main.tex is important: all your packages go there and only there. subfiles enables the magic, see separate compiles below. The demo-style is simple enough to just include it.

\documentclass[10pt,a4paper]{article}
\usepackage{subfiles}% to ease your process
\usepackage{graphicx}% for figures

\include{style/showme.sty}% a simple style

To make all your chapter-files using said preamble, just start with (all paths relate to your main-directory, so viewed from /notes/ch2.tex the main document with the preamble is one level above):

\documentclass[../main]{subfiles}% reusing said preamble

% next, just build regular document content
\begin{document}
...

Separate compiles

What is it all good for? It allows you to create and check ingredients separate from main. Here is /tikz/tria.tex compiled separately, where the outer lines come from copying it from the reader:

triag

While you are working on /notes/ch2.tex it may be convenient to check its results from time to time. Just compile that file: ch2

To check all your edits together, just compile main.tex; yes, there is a difference:

main

Please keep in mind that all references, section numbers etc. can only be correct when compiling main.tex.

Finally, this is what you'll find in the various directories of this demo. Most files are distributed, and with an editor like TexMaler and similar you probably will only see relecant .tex files ... so it will hardly be a problem:

files

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.