In my LaTeX document, I would like to put hidden data, like a marker or tag. The idea behind it is to be able to return an explicit error message. For example in this latex file, I would like to put a tag or marker where the comment line is with stars:
\documentclass[12pt]{article}
\usepackage[parfill]{parskip}
\usepackage[none]{hyphenat}
\sloppy
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{array,ragged2e, calc}
\usepackage{enumitem}
\usepackage{lipsum}
\usepackage{needspace}
\definecolor{shadecolor}{RGB}{217,217,217} % Color used for highlighting
\definecolor{light-blue}{RGB}{0,175,236} % Color for the footer
% ------------------------------------------------------------------------------------
% Header and footer management.
% ------------------------------------------------------------------------------------
\usepackage{fancyhdr}
\pagestyle{fancy}
% clear any old style settings
\fancyhf{}
\fancyheadoffset{0in}
\headheight = 53pt
\renewcommand{\headrulewidth}{0pt}
% ------------------------------------------------------------------------------------
% Defining the section style
\newcommand{\mysectionstyle}[1]{\colorbox{shadecolor}{\begin{tabular}{>{}p{\rectanglelength}}{\fontsize{13}{6}\selectfont\textbf{#1}}\end{tabular}}\vspace{6pt}}
% ------------------------------------------------------------------------------------
\addtolength{\footskip}{0.6cm}
\renewcommand{\footrulewidth}{1pt}
\renewcommand{\footrule}{{\color{light-blue}%
\vskip-\footruleskip\vskip-\footrulewidth
\hrule width\headwidth height\footrulewidth\vskip\footruleskip}}
% ------------------------------------------------------------------------------------
\usepackage[left=0.75in,top=1.5in,right=0.75in,bottom=1in]{geometry} % Document margins
\usepackage{titlesec}
\newlength{\rectanglelength}
\setlength{\rectanglelength}{\textwidth}
\addtolength{\rectanglelength}{-6pt}
\newlength{\foo}
\begin{document}
\lipsum[1]
\settototalheight{\foo}{\parbox[t]{\linewidth}{\begin{minipage}[t]{\linewidth} \begin{tabular}{@{}>{\RaggedRight}p{11cm}>{\RaggedLeft}p{6.35cm}@{}}\fontsize{13}{6}\selectfont{LaTeX}&\textbf{2011 to 2012}\end{tabular}\\\begin{tabular}{@{}>{\RaggedRight}p{11cm}>{\RaggedLeft}p{6.35cm}@{}}\textbf{Lead Programmer}&\textbf{}\end{tabular}%
\vspace{3pt}\begin{itemize}[parsep=0pt, topsep=0pt, itemsep=0pt, leftmargin=2ex]\item \lipsum[1]\item \lipsum[1]\item \lipsum[1]\item \lipsum[1]\item \lipsum[1]\item \lipsum[1]\item \lipsum[1]\item \lipsum[1]\item \lipsum[1]\end{itemize}%
\vspace{7pt}\textbf{End Title}\\\lipsum[1]
\vspace{10pt}\end{minipage}}
}
\needspace{\foo}{\setlength{\parskip}{4pt}
% ******* I WANT TO INSERT A TAG OR MARKER HERE.*******
\mysectionstyle{Experiences}
\begin{tabular}{@{}>{\RaggedRight}p{11cm}>{\RaggedLeft}p{6.35cm}@{}}\fontsize{13}{6}\selectfont{LaTeX}&\textbf{2011 to 2012}\end{tabular}\\\begin{tabular}{@{}>{\RaggedRight}p{11cm}>{\RaggedLeft}p{6.35cm}@{}}\textbf{Lead Programmer}&\textbf{}\end{tabular}%
\vspace{3pt}\begin{itemize}[parsep=0pt, topsep=0pt, itemsep=0pt, leftmargin=2ex]\item \lipsum[1]\item \lipsum[1]\item \lipsum[1]\item \lipsum[1]\item \lipsum[1]\item \lipsum[1]\item \lipsum[1]\item \lipsum[1]\item \lipsum[1]\end{itemize}%
\vspace{7pt}\textbf{End Title}\\\lipsum[1]
\vspace{10pt}}
\end{document}
I want to insert a tag or a marker into the LaTeX file so when an error occurred, I can retrieve the marker and then return a user-friendly message. Something like, there's an error in section X.
Is it possible in LaTeX? If yes, how can I do that?
\PackageErrorcommand itself to customize the error messages generated by packages you use. It depends on what errors you would like to catch... – Peater de Xel Apr 01 '13 at 16:51