我使用 pdflatex 创建 PDF 文档,方法是通过循环将多个.tex
文件相互连接\input
起来。现在我想在单个.tex
文件中引入一个布尔值。根据 true 或 false,应该使用不同的标头。但是,我不知道如何在尚未导入的情况下获取值.tex
。
编辑:
这是一个简单的例子:
例子.tex
\documentclass[10pt]{article}
\usepackage[a4paper, left=2cm,top=0.8cm,right=2cm,bottom=3.3cm,headheight=61pt, footskip=61pt, includehead]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[ngerman]{babel}
\usepackage{fancyhdr}
\usepackage{tikz}
\usepackage{xifthen}
\definecolor{accentcolor}{HTML}{66cc33}
\fancypagestyle{plain}{%
\renewcommand{\headrulewidth}{0pt}%
\fancyhf{}%
\lhead{\LARGE{{\normalfont\MakeUppercase Details}\\\textcolor{accentcolor}{\Large Test}}}
\rhead{right side}
}
\pagestyle{plain} %
\newboolean{projectHighlight}
%#####################################################################################################################################################
\begin{document}
\input{details_file}
%all projects from folder desc.:
\let\mylist\empty
\foreach\x in {00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, ...,99} {
\ifx\mylist\empty
\xdef\mylist{\x}%
\else
\xdef\mylist{\x,\mylist}%
\fi
}
\foreach\x in \mylist {% The % here are necessary to eliminate any spurious spaces that may get inserted at these points
\edef\projectNumber{\x}%
\edef\FileName{project_\x}%
\IfFileExists{\FileName}{%
\newpage%
\input{\FileName}%
\ifthenelse{\boolean{projectHighlight}}{\lhead{\LARGE{{\normalfont\MakeUppercase Highlited}\\\textcolor{accentcolor}{\Large Test}}}}
{\lhead{\LARGE{{\normalfont\MakeUppercase Not Highlihhted}\\\textcolor{accentcolor}{\Large Test}}}}
}
}
\end{document}
详细信息文件.tex
some details
项目_01.tex
\setboolean{projectHighlight}{true}
Text first project
项目_2.tex
\setboolean{projectHighlight}{true}
Text second project