/// <summary>
        /// Inizialize the LaTeX Document
        /// </summary>
        /// <param name="LaTeXExecutable">Path to the LaTeX Compiler Executable</param>
        /// <param name="FileFolder">Path to the folder to work with</param>
        /// <param name="Margins">Document Margin in inch</param>
        /// <param name="LatexPackages">Packages to be added in the document</param>
        private void Init(string LaTeXExecutable, string FileFolder, LatexDocumentMargins Margins, List <string> LatexPackages)
        {
            if (FileFolder.Contains(" "))
            {
                throw new Exception("File folder path can't cointains space!");
            }

            this.LatexPackages = new List <string>();
            this.LatexPackages.AddRange(LatexPackages);

            if (!Directory.Exists(FileFolder))
            {
                Directory.CreateDirectory(FileFolder);
            }
            if (!File.Exists(LaTeXExecutable))
            {
                throw new Exception("The LaTeX executable doesen't exist!");
            }
            if (!LaTeXExecutable.EndsWith(".exe"))
            {
                throw new Exception("The selected LaTeX executable is not an executable!");
            }

            LATEX_EXECUTABLE = LaTeXExecutable;
            FILE_FOLDER      = FileFolder;
            IMAGE_FOLDER     = Path.Combine(FILE_FOLDER, @"images\");
            this.Margins     = Margins;
            if (!Directory.Exists(IMAGE_FOLDER))
            {
                Directory.CreateDirectory(IMAGE_FOLDER);
            }

            System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
            customCulture.NumberFormat.NumberDecimalSeparator = ".";

            System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;

            sb = new StringBuilder();
            sb.AppendLine(@"\documentclass{article}");
            sb.AppendLine(@"\usepackage[utf8]{inputenc}");
            sb.AppendLine(@"\usepackage{graphicx}");
            sb.AppendLine(string.Format(@"\graphicspath{{{0}}}", "{" + IMAGE_FOLDER.Replace("\\", "/") + "}"));
            sb.AppendLine(@"\usepackage{multicol}");
            sb.AppendLine(@"\usepackage{pgf-pie}");
            sb.AppendLine(@"\usepackage{pgfplots}");
            sb.AppendLine(@"\usepackage{tikz}");
            sb.AppendLine(@"\usepackage{wrapfig}");
            sb.AppendLine(@"\usepackage{mathtools}");
            sb.AppendLine(@"\usepackage{color}");
            sb.AppendLine(@"\pgfplotsset{compat=1.15}");
            sb.AppendLine(@"\usepackage{lipsum}");
            sb.AppendLine(string.Format(@"\usepackage[tmargin={0}in,bmargin={1}in,lmargin={2}in,rmargin={3}in]", Margins.Top, Margins.Bottom, Margins.Right, Margins.Left) + @"{geometry}");

            foreach (string package in LatexPackages)
            {
                sb.AppendLine(string.Format(@"\usepackage{{{0}}}", package));
            }

            sb.AppendLine(@"\begin{document}");
        }
 public Document(string LaTeXExecutable, string FolderName, LatexDocumentMargins Margins, List <string> LatexPackages)
 {
     Init(LaTeXExecutable, FolderName, new LatexDocumentMargins(), LatexPackages);
 }
 public Document(string LaTeXExecutable, string FolderName, LatexDocumentMargins Margins)
 {
     Init(LaTeXExecutable, FolderName, Margins, new List <string>());
 }