The Thinking Path – LaTeX: My Journey with Structure, Syntax & Style

💭Introduction

Creating a LaTeX-based project to document a problem-solving journey is not just about typesetting — it's about shaping a system. The Thinking Path began as a simple idea to make neat notes, but it quickly evolved into a full-blown experiment in design, structure, and patience. Here are the hurdles I faced along the way, and how I overcame them.

1️⃣ Initial Layout Issues – Taming the tcolorbox

At first, setting up tcolorbox was chaotic. Titles inside vs. outside, inconsistent margins, alignment issues—it was overwhelming.

% Answer box command
\newcommand{\problemAnswer}[1]{%
\begin{tcolorbox}[
  colback=gray!10!white,
  title=,
  listing only,
  listing options={style=mypython}
]
\large
#1 % Python code goes here
\end{tcolorbox}
}

2️⃣ Displaying Python Code Cleanly – Enter listings Package

One of my goals was to present Python code clearly, with line numbers and shading. After trying many formats, listings + tcolorbox turned out to be the best combo.

% Python style
\lstdefinestyle{mypython}{
    backgroundcolor=\color{codegray},
    commentstyle=\color{commentgreen}\ttfamily\normalsize,
    keywordstyle=\color{keywordblue}\bfseries,
    stringstyle=\color{red!60!black},
    numberstyle=\small\color{gray},
    basicstyle=\ttfamily\normalsize,
    breaklines=true,
    frame=single,
    numbers=left,
    numbersep=5pt,
    showstringspaces=false,
    tabsize=4,
    language=Python,
    columns=fullflexible, % Fixes whitespace collapse
    keepspaces=true      % Preserves spaces in code
}

✅ This helped make my code visually distinct and easy to follow.



3️⃣ Mastering Vertical & Horizontal Spacing

\vspace often failed me, especially near page breaks. Switching to \vspace* and \hspace* solved that problem.

In LaTeX, spacing commands like \vspace and \hspace help control layout. However, I faced issues when spaces didn’t show up—especially at the start of a page or between environments. That’s when I discovered the starred versions of these commands:

🔹 What's the difference between \vspace and \vspace*?

  • \vspace{10pt} adds space only if LaTeX allows it. If used at the top of a page or between floats, it might be ignored.

  • \vspace*{10pt} forces the space even at the top of a page. It's reliable for consistent layout.

🔹 Similarly:

  • \hspace{5pt} might be skipped in tight layout situations.

  • \hspace*{5pt} ensures the space appears, even at the line's start.

I used the starred versions (*) to make sure my spacing worked no matter where the command was placed—especially helpful around section breaks or day dividers.



4️⃣ Custom Section/Subsection Commands

To keep formatting consistent and the Table of Contents neat, I created my own sectioning commands.

% Custom command for unnumbered sections
\newcommand{\mysection}[1]{%
  \section*{\texorpdfstring{$\underrightarrow{\text{#1}}$}{#1}}%
  \phantomsection%
  \addcontentsline{toc}{section}{#1}%
}

% Custom command for unnumbered subsections
\newcommand{\mysubsection}[1]{%
  \subsection*{#1}%
  \phantomsection%
  \addcontentsline{toc}{subsection}{#1}%
}

5️⃣ Day Separator Design with TikZ

For visually dividing entries by date, I designed a neat dotted line using TikZ.

% For dotted lines and separator
\newcommand{\daySeparator}{
    \vspace{1cm}
    \begin{center}
        \begin{tikzpicture}
            \draw[dash pattern=on 5pt off 3pt, thick] (0,0) -- (0.98\linewidth,0);
        \end{tikzpicture}
    \end{center}
    \vspace{1cm}
}

6️⃣ Header/Footer Tweaks – Fancyhdr to the Rescue

fancyhdr let me personalize headers and footers. But I had to exclude them from my title and intro pages — and that wasn’t easy!

\pagestyle{fancy}
\lhead{30 Day Problem Challenge}
\chead{}
\rhead{AB}
\lfoot{}
\cfoot{Page : \thepage }
\rfoot{}

7️⃣ Custom Title Block Design

Combining a logo and title in perfect alignment was one of the hardest parts. I used tabularx, minipage, and a lot of trial-and-error.

% Template values
\newcommand{\myLogo}{LaTeX PROJECT PHOTO}
\newcommand{\myName}{YOUR NAME}
\newcommand{\myJobTitle}{YOUR JOBTITLE}
\newcommand{\myLocation}{LOCATION}
\newcommand{\myURL}{URL FOR LINKEDLN}
\newcommand{\mygithub}{YOUR GITHUB PROFILE}
\newcommand{\myEmail}{WORK EMAIL}
\newcommand{\myAssignment}{NAME OF THE PROJECT}
\newcommand{\mydate}{DATE}


% Macro for custom title page signature header
\newsavebox{\myTitleSignature}
\sbox{\myTitleSignature}{%
\begin{tabularx}{\textwidth}{@{}l X@{}}
\begin{minipage}[c][5pt][c]{\hsize}
  \raggedright\textbf{\myName} \\
  {\small \myJobTitle} \\
  {\small \myLocation} \\
  {\small \url{https://\myURL}} \\
  {\small \url{https://\mygithub}} \\
  {\small \href{mailto:\myEmail}{\myEmail}}
\end{minipage}
&
\begin{minipage}[c][1.5in][c]{\hsize}
  \centering
  \includegraphics[height=1.5in]{\myLogo}
\end{minipage}
\end{tabularx}
}

% Use custom title macro instead
\usebox{\myTitleSignature}

8️⃣ Symbol Confusions & Formatting Errors

There were frequent LaTeX errors like:

  • “Missing $ inserted” for symbols like ^, #, or \not outside math mode.

  • Overfull boxes from URLs or tabularx misalignment.

  • Misused math symbols — especially , , , and ₹ (Rupee).

  • Problems when adding fading lines or decorative elements.


Math Symbols Reference Sheet

For anyone who wants to use LaTeX for notes, here’s a quick-reference table of math symbols I used in my project:

Symbol


Meaning


Not Equal

Approximately

Implies

Element of

Summation

Subset

For all

Rupee symbol

LaTeX Code


\neq

\approx

\Rightarrow

\in

\sum

\subseteq

\forall

\rupee (custom command or fontspec)

and lot more...
If you're using XeLaTeX or LuaLaTeX, symbols like ₹ can be inserted with font packages or Unicode characters.

🎯 Final Thoughts

This project taught me more about LaTeX than any tutorial ever could. If you're building something similar, embrace the frustration — because once you figure it out, your document becomes a personal masterpiece.

Here is the Google Drive containing the Document (.pdf) and (.tex) file for the project. Feel free to check it out and comment for any feedback --- 

Comments

Popular posts from this blog

📊 Analyst Forge: A 30-Day Self-Driven Data Analyst Challenge Using Python, Jupyter & Power BI

StackSprint_LP — My Complete Learning Path to Master APIs, JSON & Real-World Integrations