OpenMP-Examples/openmp.sty
2024-11-13 11:07:08 -08:00

688 lines
26 KiB
TeX

% This is openmp.sty, the preamble and style definitions for the OpenMP specification.
% This is an include file. Please see the main file for more information.
%
% When editing this file:
%
% 1. To change formatting, appearance, or style, please edit openmp.sty.
%
% 2. Custom commands and macros are defined in openmp.sty.
%
% 3. Be kind to other editors -- keep a consistent style by copying-and-pasting to
% create new content.
%
% 4. We use semantic markup, e.g. (see openmp.sty for a full list):
% \code{} % for bold monospace keywords, code, operators, etc.
% \plc{} % for italic placeholder names, grammar, etc.
%
% 5. Other recommendations:
% Use the convenience macros defined in openmp.sty for the minor headers
% such as Comments, Syntax, etc.
%
% To keep items together on the same page, prefer the use of
% \begin{samepage}.... Avoid \parbox for text blocks as it interrupts line numbering.
% When possible, avoid \filbreak, \pagebreak, \newpage, \clearpage unless that's
% what you mean. Use \needspace{} cautiously for troublesome paragraphs.
%
% Avoid absolute lengths and measures in this file; use relative units when possible.
% Vertical space can be relative to \baselineskip or ex units. Horizontal space
% can be relative to \linewidth or em units.
%
% Prefer \emph{} to italicize terminology, e.g.:
% This is a \emph{definition}, not a placeholder.
% This is a \plc{var-name}.
%
% Quick list of the environments, commands and macros supported. Search below for more details.
%
% \binding % makes header of the same name
% \comments
% \constraints
% \crossreferences
% \descr
% \effect
% \format
% \restrictions
% \summary
% \syntax
%
% \code{} % monospace, bold
% \plc{} % for any kind of placeholder: italic
% \begin{codepar} % for blocks of verbatim code: monospace, bold
% \begin{boxedcode} % outlined verbatim code for syntax definitions, prototypes, etc.
% \begin{indentedcodelist} % used with,e.g., "where clause is one of the following:"
%
% \specref{} % formats the cross-reference "Section X on page Y"
%
% \begin{note} % black horizontal rule for Notes
% \end{note}
%
% \begin{cspecific} % blue horizontal rule for C-specific text
% \end{cspecific}
%
% \begin{cppspecific} % blue horizontal rule for C++ -specific text
% \end{cppspecific}
%
% \begin{ccppspecific} % blue horizontal rule for C/C++ -specific text
% \end{ccppspecific}
%
% \begin{fortranspecific} % blue horizontal rule for Fortran-specific text
% \end{fortranspecific}
%
% \glossaryterm % for use in formatting glossary entries
% \glossarydefstart
% \glossarydefend
%
% \compactitem % single-spaced itemized lists for the Examples doc
% \cexample % C/C++ code example for the Examples doc
% \fexample % Fortran code example for the Examples doc
\usepackage{comment} % allow use of \begin{comment}
\usepackage{ifpdf,ifthen} % allow conditional tests in LaTeX definitions
\usepackage{makecell} % Allows common formatting in cells with \thread & \makecell
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document data
%
\author{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fonts
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{courier}
\usepackage{helvet}
\usepackage[utf8]{inputenc}
% Main body serif font:
\usepackage{tgtermes}
\usepackage[T1]{fontenc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Graphic elements
\usepackage{graphicx}
\usepackage{framed} % for making boxes with \begin{framed}
\usepackage{tikz} % for flow charts, diagrams, arrows
\usepackage{subcaption} % For subfigure
\usepackage{float} % To fix location of figure: \begin{figure}[H] for no float
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Page formatting
%
% The PDF and book version need different margin spaces. The bookbuild
% macro is set by the build system (see Makefile) to determine whether
% we are building the PDF or the print-on-demand book version of the spec.
%
\ifdefined\bookbuild
% we are building the book version of the spec, so we need to have a bit
% more margin for the publisher to print
\usepackage[paperwidth=8in, paperheight=10in,
top=1.25in, bottom=1.5in, left=1.65in, right=0.85in]{geometry}
\setlength{\oddsidemargin}{0.875in}
\setlength{\evensidemargin}{0.385in}
\else
% we are building the PDF version of the spec, so we can use the default
% margins
\usepackage[paperwidth=7.5in, paperheight=9in,
top=0.75in, bottom=1.0in, left=1.4in, right=0.6in]{geometry}
\setlength{\oddsidemargin}{0.45in}
\setlength{\evensidemargin}{0.185in}
\fi
\usepackage{changepage} % allows left/right-page margin readjustments
\raggedbottom
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Paragraph formatting
\usepackage{setspace} % allows use of \singlespacing, \onehalfspacing
\usepackage{needspace} % allows use of \needspace to keep lines together
\usepackage{parskip} % removes paragraph indenting
\raggedright
\usepackage[raggedrightboxes]{ragged2e} % is this needed?
\lefthyphenmin=60 % only hyphenate if the left part is >= this many chars
\righthyphenmin=60 % only hyphenate if the right part is >= this many chars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Bulleted (itemized) lists
% Align bullets with section header
% Align text left
% Small bullets
% \compactitem for single-spaced lists (used in the Examples doc)
\usepackage{enumitem} % for setting margins on lists
\setlist{leftmargin=*} % don't indent bullet items
\renewcommand{\labelitemi}{{\normalsize$\bullet$}} % bullet size
% There is a \compactitem defined in package parlist (and perhaps others), however,
% we'll define our own version of compactitem in terms of package enumitem that
% we already use:
\newenvironment{compactitem}
{\begin{itemize}[itemsep=-1.2ex]}
{\end{itemize}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Tables
% This allows tables to flow across page breaks, headers on each new page, etc.
\usepackage{supertabular}
\usepackage{caption}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Line numbering
\usepackage[pagewise]{lineno} % for line numbers on left side of the page
\pagewiselinenumbers
\setlength\linenumbersep{6em}
\renewcommand\linenumberfont{\normalfont\small\sffamily}
\nolinenumbers % start with line numbers off
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Footers
\usepackage{fancyhdr} % makes right/left footers
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\cfoot{}
\renewcommand{\headrulewidth}{0pt}
% Left side on even pages:
% This requires that \footerText be defined in the main document:
\fancyfoot[LE]{\bfseries \thepage \mdseries \hspace{2em} \footerText}
\fancyhfoffset[E]{4em}
% Right side on odd pages:
\fancyfoot[RO]{\mdseries \leftmark \hspace{2em} \bfseries \thepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Section header format - we use four levels: \chapter \section \subsection \subsubsection.
\usepackage{titlesec} % format headers with \titleformat{}
\usepackage{tocloft}
% Format and spacing for chapter, section, subsection, and subsubsection headers:
\setcounter{secnumdepth}{4} % show numbers down to subsubsection level
\titleformat{\chapter}[hang]%
{\normalfont\sffamily\upshape\Huge\bfseries\fontsize{20}{20}\selectfont}%
{\thechapter}{0.5em}{}
\titlespacing{\chapter}{0ex}{0em plus 1em minus 1em}{2em plus 1em minus 0em}[10em]
\titleformat{\section}[hang]{\huge\bfseries\sffamily\fontsize{16}{16}\selectfont}{\thesection}{0.5em}{}
\titlespacing{\section}{0em}{3em plus 1em minus 1em}{1em plus 0.5em minus 0em}[10em]
\titleformat{\subsection}[hang]{\LARGE\bfseries\sffamily\fontsize{14}{14}\selectfont}{\thesubsection}{0.5em}{}
\titlespacing{\subsection}{0em}{3em plus 1em minus 1em}{0.75em plus 0.5em minus 0em}[10em]
\titleformat{\subsubsection}[hang]{\needspace{1\baselineskip}%
\Large\bfseries\sffamily\fontsize{12}{12}\selectfont}{\thesubsubsection}{0.5em}{}
\titlespacing{\subsubsection}{0em}{3em plus 1em minus 1em}{0.5em plus 0.5em minus 0em}[10em]
\setlength{\cftbeforetoctitleskip}{1.0ex}
\setlength{\cftaftertoctitleskip}{3.0ex}
\setlength{\cftbeforeloftitleskip}{1.0ex}
\setlength{\cftafterloftitleskip}{3.0ex}
\setlength{\cftbeforelottitleskip}{1.0ex}
\setlength{\cftafterlottitleskip}{3.0ex}
\renewcommand{\cftchapaftersnum}{}
\makeatletter
\renewcommand{\l@section}{\@dottedtocline{1}{1.5em}{2.6em}}
\renewcommand{\l@subsection}{\@dottedtocline{2}{4.1em}{3.4em}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macros for minor headers: Summary, Syntax, Description, etc.
% These headers are defined in terms of \paragraph
\titleformat{\paragraph}[block]{\large\bfseries\sffamily\fontsize{11}{11}\selectfont}{}{}{}
\titlespacing{\paragraph}{0em}{1.5em plus 0.55em minus 0.5em}{0.0em plus 0.55em minus 0.0em}
% Use one of the convenience macros below, or \littleheader{} for an arbitrary header
\newcommand{\littleheader}[1] {\paragraph*{#1}}
\newcommand{\binding} {\littleheader{Binding}}
\newcommand{\comments} {\littleheader{Comments}}
\newcommand{\constraints} {\littleheader{Constraints on Arguments}}
\newcommand{\crossreferences} {\littleheader{Cross References}}
\newcommand{\descr} {\littleheader{Description}}
\newcommand{\effect} {\littleheader{Effect}}
\newcommand{\format} {\littleheader{Format}}
\newcommand{\restrictions} {\littleheader{Restrictions}}
\newcommand{\summary} {\littleheader{Summary}}
\newcommand{\syntax} {\littleheader{Syntax}}
\usepackage{scrlayer}
\DeclareNewLayer[foreground,textarea,contents={
\phantom{a}
\emph{This page intentionally left blank}
}
]{intentionally.text}
\DeclareNewPageStyleByLayers{intentionally}{intentionally.text}
\renewcommand{\cleardoublepage}{\cleardoubleoddpageusingstyle{intentionally}}
\newcommand{\chapdirname}{}
\newcommand{\cchapter}[2] {\cleardoublepage\chapter{#1}%
\renewcommand{\chapdirname}{#2}}
\newcommand{\bchapter}[1] {\chapter*{#1}%
\addcontentsline{toc}{chapter}{\protect\numberline{}#1}}
%\newcommand{\sinput}[1] {\input{\chapdirname/#1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code and placeholder semantic tagging.
%
% When possible, prefer semantic tags instead of typographic tags. The
% following semantics tags are defined here:
%
% \code{} % for bold monospace keywords, code, operators, etc.
% \plc{} % for italic placeholder names, grammar, etc.
%
% For function prototypes or other code snippets, you can use \code{} as
% the outer wrapper, and use \plc{{} inside. Example:
%
% \code{\#pragma omp directive ( \plc{some-placeholder-identifier} :}
%
% To format text in italics for emphasis (rather than text as a placeholder),
% use the generic \emph{} command. Example:
%
% This sentence \emph{emphasizes some non-placeholder words}.
% Enable \alltt{} for formatting blocks of code:
\usepackage{alltt}
\usepackage{toolbox} % for \toolboxReplace
% This sets the default \code{} font to tt (monospace) and bold:
\newcommand\code[1]{\texttt{\textbf{#1}}}
\newcommand\scode[1]{\protect\textbf{\protect\texttt{\protect\detokenize{#1}}}}
% This defines the \plc{} placeholder font to be tt normal slanted:
\newcommand\plc[1]{\textrm{\textmd{\itshape{#1}}}}
\newcommand\splc[1]{\protect\textit{\protect\textrm{\protect\detokenize{#1}}}}
% This is an updated set of macros for code style work
% kcode - keywords, vcode - value, bcode - base language,
% pvar - variables, pout - program outputs
\protected\def\DoReplaceU#1{\def\utexttmp{#1}%
\toolboxReplace{_}{\_}\utexttmp\utexttmp}
\protected\def\myreplacedmt#1#2{\def\stexttmp{#1}%
\toolboxReplace{_}{\_}\stexttmp%
\toolboxReplace{ }{\rmfamily{ }\ttfamily#2}\stexttmp%
{\ttfamily#2\stexttmp}}
\newcommand\kcode[1]{\myreplacedmt{#1}{\bfseries\upshape}}
\newcommand\vcode[1]{\myreplacedmt{#1}{\mdseries\upshape}}
\newcommand\bcode[1]{\kcode{#1}}
\newcommand\ucode[1]{\myreplacedmt{#1}{\mdseries\slshape}}
\newcommand\pvar[1]{\ucode{#1}}
\newcommand\pout[1]{\vcode{#1}}
\newcommand\docref[1]{\textrm{\mdseries\itshape{#1}}}
\newcommand\example[1]{\splc{#1}}
\newcommand\examplesrepo{https://github.com/OpenMP/Examples}
\newcommand\examplestree[2]{\href{\examplesrepo/tree/v#1}{#2}}
\newcommand\examplesref[1]{\examplestree{#1}{#1}}
\newcommand\examplesblob[1]{\href{\examplesrepo/blob/#1}{#1}}
% Environment for a paragraph of literal code, single-spaced, no outline, no indenting:
\usepackage{listings}
\lstnewenvironment{codepar}{%
}{}
%\newenvironment{codepar}[1]
%{\begin{alltt}\bfseries #1}
%{\end{alltt}}
% For blocks of code inside a box frame:
\lstnewenvironment{boxedcode}{%
\lstset{framesep=1.2ex,frame=l,framerule=3pt,
backgroundcolor=\color{white!90!black}}}{}
\lstnewenvironment{boxeducode}{%
\lstset{framesep=1.2ex,frame=l,framerule=3pt,
basicstyle=\ttfamily\mdseries\slshape,
backgroundcolor=\color{white!90!black}}}{}
%\newenvironment{boxedcode}[1]
%{\vspace{0.25em plus 5em minus %0.25em}\begin{framed}\begin{minipage}[t]{\textwidth}\begin{alltt}\bfseries #1}
%{\end{alltt}\end{minipage}\end{framed}\vspace{0.25em plus 5em minus 0.25em}}
% This sets the margins in the framed box:
\setlength{\FrameSep}{0.6em}
% For indented lists of verbatim code at a relaxed line spacing,
% e.g., for use after "where clause is one of the following:"
\usepackage{setspace}
\lstnewenvironment{indentedcodelist}{%
\lstset{xleftmargin=0.25in}}{}
%\newenvironment{indentedcodelist}{%
%\begin{adjustwidth}{0.25in}{}\vspace{-0.2\baselineskip}\begin{spacing}{1.2}\beg%in{alltt}\bfseries}
% {\end{alltt}\end{spacing}\vspace{-0.2\baselineskip}\end{adjustwidth}}
\lstdefinestyle{openmp}{
showstringspaces=false,
basicstyle=\ttfamily\bfseries,
linewidth=.99\linewidth,
xleftmargin=0.01\linewidth,
columns=fullflexible,
keepspaces=true,
escapechar=@,
belowskip=\smallskipamount,
aboveskip=\smallskipamount,
morecomment=[l][\color{red}\sout]{\%DIF\ <}, % deleted empty lines
morecomment=[l][\color{blue}\uwave]{\%DIF\ >}, % added empty lines
moredelim=[il][\color{red}\sout]{\%DIF\ <\ }, % deleted lines
moredelim=[il][\color{blue}\uwave]{\%DIF\ >\ }, % added lines
moredelim=**[is][\rmfamily\mdseries\itshape]{\\plc\{}{\}},
moredelim=**[is][\textsubscript]{\\textsubscript\{}{\}},
moredelim=**[is][]{\\textnormal\{}{\}},
moredelim=**[is][\rmfamily\mdseries\itshape]{\\textsl\{}{\}},
moredelim=**[is][\ttfamily\mdseries\slshape]{\\ucode\{}{\}},
moredelim=**[is][\ttfamily\bfseries\upshape]{\\kcode\{}{\}},
moredelim=**[is][]{\\code\{}{\}},
moredelim=**[is][]{\\scode\{}{\}},
moredelim=*[is][\color{red}\sout]{*!----}{----!*},
moredelim=*[is][\color{blue}\uwave]{*!++++}{++++!*},
moredelim=**[is][\mdseries\rmfamily]{\\text\{}{\}},
}
\lstset{style=openmp}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macros for the black and blue lines and arrows delineating language-specific
% and notes sections. Example:
%
% \fortranspecificstart
% This is text that applies to Fortran.
% \fortranspecificend
% local parameters for use \linewitharrows and \notelinewitharrows:
\newlength{\sbsz}\setlength{\sbsz}{0.05in} % size of arrows
\newlength{\sblw}\setlength{\sblw}{1.35pt} % line width (thickness)
\newlength{\sbtw} % text width
\newlength{\sblen} % total width of horizontal rule
\newlength{\sbht} % height of arrows
\newlength{\sbhadj} % vertical adjustment for aligning arrows with the line
\newlength{\sbns}\setlength{\sbns}{7\baselineskip} % arg for \needspace for downward arrows
% \notelinewitharrows is a helper command that makes a black Note marker:
% arg 1 = 1 or -1 for up or down arrows
% arg 2 = solid or dashed or loosely dashed, etc.
\newcommand{\notelinewitharrows}[2]{%
\needspace{0.1\baselineskip}%
\vbox{\begin{tikzpicture}%
\setlength{\sblen}{\linewidth}%
\setlength{\sbht}{#1\sbsz}\setlength{\sbht}{1.4\sbht}%
\setlength{\sbhadj}{#1\sblw}\setlength{\sbhadj}{0.25\sbhadj}%
\filldraw (\sblen, 0) -- (\sblen - \sbsz, \sbht) -- (\sblen - 2\sbsz, 0) -- (\sblen, 0);
\draw[line width=\sblw, #2] (2\sbsz - \sblw, \sbhadj) -- (\sblen - 2\sbsz + \sblw, \sbhadj);
\filldraw (0, 0) -- (\sbsz, \sbht) -- (0 + 2\sbsz, 0) -- (0, 0);
\end{tikzpicture}}}
% \linewitharrows is a helper command that makes a blue horizontal line, up or down arrows, and some text:
% arg 1 = 1 or -1 for up or down arrows
% arg 2 = solid or dashed or loosely dashed, etc.
% arg 3 = text
% arg 4 = text width
\newcommand{\linewitharrows}[4]{%
\needspace{0.1\baselineskip}%
\vbox to 1\baselineskip {\begin{tikzpicture}%
\setlength{\sbtw}{#4}%
\setlength{\sblen}{\linewidth}%
\setlength{\sbht}{#1\sbsz}\setlength{\sbht}{1.4\sbht}%
\setlength{\sbhadj}{#1\sblw}\setlength{\sbhadj}{0.25\sbhadj}%
\filldraw[color=blue!40] (\sblen, 0) -- (\sblen - \sbsz, \sbht) -- (\sblen - 2\sbsz, 0) -- (\sblen, 0);
\draw[line width=\sblw, color=blue!40, #2] (2\sbsz - \sblw, \sbhadj) -- (0.5\sblen - 0.5\sbtw, \sbhadj);
\draw[line width=\sblw, color=blue!40, #2] (0.5\sblen + 0.5\sbtw, \sbhadj) -- (\sblen - 2\sbsz + \sblw, \sbhadj);
\filldraw[color=blue!40] (0, 0) -- (\sbsz, \sbht) -- (0 + 2\sbsz, 0) -- (0, 0);
\node[color=blue!90] at (0.5\sblen, 0) {\large \textsf{\textup{#3}}};
\end{tikzpicture}}}
\newcommand{\VSPb}{\vspace{0.5ex plus 5ex minus 0.25ex}}
\newcommand{\VSPa}{\vspace{0.25ex plus 5ex minus 0.25ex}}
% remove language marker definition if either ccpp or fortran is undefined
\ifthenelse{\boolean{ccpp}\and\boolean{fortran}}{}%
{\renewcommand{\linewitharrows}[4]{\par}}
\newcommand{\langselect}{}
\ifccpp\else\renewcommand{\langselect}{Fortran~}\fi
\iffortran\else\renewcommand{\langselect}{C/C++~}\fi
% C
\ifccpp
\newenvironment{cspecific}[1][0ex]{\vspace{#1}\cspecificstart\vspace{-#1}}{\cspecificend}
\else
\excludecomment{cspecific}
\fi
\newcommand{\cspecificstart}{\needspace{\sbns}\linewitharrows{-1}{solid}{C}{3em}}
\newcommand{\cspecificend}{\linewitharrows{1}{solid}{C}{3em}\bigskip}
% C/C++
\ifccpp
\newenvironment{ccppspecific}[1][0ex]{\vspace{#1}\ccppspecificstart\vspace{-#1}}{\ccppspecificend}
\else
\excludecomment{ccppspecific}
\fi
\newcommand{\ccppspecificstart}{\VSPb\linewitharrows{-1}{solid}{C / C++}{6em}\VSPa}
\newcommand{\ccppspecificend}{\VSPb\linewitharrows{1}{solid}{C / C++}{6em}\VSPa}
% C++
\ifccpp
\newenvironment{cppspecific}[1][0ex]{\vspace{#1}\cppspecificstart\vspace{-#1}}{\cppspecificend}
\else
\excludecomment{cppspecific}
\fi
\newcommand{\cppspecificstart}{\needspace{\sbns}\linewitharrows{-1}{solid}{C++}{6em}}
\newcommand{\cppspecificend}{\linewitharrows{1}{solid}{C++}{6em}\bigskip}
% C90
\newenvironment{cNinetyspecific}{\cNinetyspecificstart}{\cNinetyspecificend}
\newcommand{\cNinetyspecificstart}{\needspace{\sbns}\linewitharrows{-1}{solid}{C90}{4em}}
\newcommand{\cNinetyspecificend}{\linewitharrows{1}{solid}{C90}{4em}\bigskip}
% C99
\newenvironment{cNinetyNinespecific}{\cNinetyNinespecificstart}{\cNinetyNinespecificend}
\newcommand{\cNinetyNinespecificstart}{\needspace{\sbns}\linewitharrows{-1}{solid}{C99}{4em}}
\newcommand{\cNinetyNinespecificend}{\linewitharrows{1}{solid}{C99}{4em}\bigskip}
% Fortran
\iffortran
\newenvironment{fortranspecific}[1][0ex]{\vspace{#1}\fortranspecificstart\vspace{-#1}}{\fortranspecificend}
\else
\excludecomment{fortranspecific}
\fi
\newcommand{\fortranspecificstart}{\VSPb\linewitharrows{-1}{solid}{Fortran}{6em}\VSPa}
\newcommand{\fortranspecificend}{\VSPb\linewitharrows{1}{solid}{Fortran}{6em}\VSPa}
% Note
\newenvironment{note}{\notestart}{\noteend}
\newcommand{\notestart}{\VSPb\notelinewitharrows{-1}{solid}\VSPa}
\newcommand{\noteend}{\VSPb\notelinewitharrows{1}{solid}\VSPa}
% convenience macro for formatting the word "Note:" at the beginning of note blocks:
\newcommand{\noteheader}{{\textrm{\textsf{\textbf\textup\normalsize{{{{Note }}}}}}}}
% blue line floater at top of a page for "Name (cont.)"
\newcommand{\topmarker}[1]{%
\begin{figure}[t!]
\linewitharrows{-1}{dashed}{#1 (cont.)}{8em}
\end{figure}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Glossary formatting
\newcommand{\glossaryterm}[1]{\needspace{1ex}
\begin{adjustwidth}{-0.75in}{0.0in}
\nolinenumbers\parbox[b][-0.95\baselineskip][t]{1.4in}{\flushright \textbf{#1}}
\end{adjustwidth}\linenumbers}
\newcommand{\glossarydefstart}{
\begin{adjustwidth}{0.79in}{0.0in}}
\newcommand{\glossarydefend}{
\end{adjustwidth}\vspace{-1.5\baselineskip}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Indexing and Table of Contents
\usepackage{makeidx}
\usepackage[nodotinlabels]{titletoc} % required for its [nodotinlabels] option
% Clickable links in TOC and index:
\usepackage[hyperindex=true,linktocpage=true]{hyperref}
\hypersetup{
bookmarksnumbered = true,
bookmarksopen = false,
colorlinks = true, % Colors links instead of red boxes
urlcolor = blue, % Color for external links
linkcolor = blue % Color for internal links
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Formats a cross reference label as "Section X on page Y".
\newcommand{\nspecref}[2]{#1~\ref{#2} on page~\pageref{#2}}
\newcommand{\specref}[1]{\nspecref{Section}{#1}}
% For caption for supertabular and figure, by yanyh15
\captionsetup[table]{labelfont={sf,sc,bf},textfont=normalfont,singlelinecheck=off,labelformat=simple,labelsep=colon,aboveskip=00pt,belowskip=10pt}
\captionsetup[figure]{labelfont={sf,sc,bf},textfont=normalfont,singlelinecheck=off,labelformat=simple,labelsep=colon}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code example formatting for the Examples document
% This defines:
% \cexample formats blue markers, caption, and code for C examples
% \cppexample formats blue markers, caption, and code for C++ examples
% \fexample formats blue markers, caption, and code for Fortran (fixed) examples
% \ffreeexample formats blue markers, caption, and code for Fortran90 (free) examples
\usepackage{color,fancyvrb} % for \VerbatimInput
\usepackage{xargs} % for optional args
\renewcommand\theFancyVerbLine{\normalfont\footnotesize\sffamily S-\arabic{FancyVerbLine}}
\newcommand{\escstr}[1]{\DoReplaceU{#1}}
\newcommandx*\verlabel[2][1=]{(\code{\small{}#1omp\_#2})}
\newcommand{\exampleheader}[6]{%
\ifthenelse{ \equal{#1}{} }{
\def\cname{#2}
\def\ename\cname
}{
\def\cname{#1.#2.#3}
% Use following line for old numbering
% \def\ename{\thechapter.#2.#3}
% Use following for mneumonics
\def\ename{\escstr{#1}.\escstr{#2}.#3}
}
\newcount\cnt
\cnt=#4
\ifthenelse{ \equal{#5}{0} }{}{\global\advance\cnt by #5}
\def\cverno{\ref{ex_vtag:\cname}}
\ifthenelse{ \equal{\cverno}{pre_3.0} }{\def\cverno{}}{}
\ifthenelse{ \equal{\cverno}{??} }{\def\cverno{#6}}{}
\def\stagcnt{\pageref{ex_vtag:\cname}}
\ifthenelse{ \equal{\cverno}{} }{
\global\advance\cnt by 1
\def\vername{\;\;\verlabel[pre\_]{3.0}}
}{
\def\myver##1{\toolboxSplitAt{##1}{_}\lefttext\righttext
\lefttext\toolboxIfElse{\ifx\righttext\undefined}%
{\global\advance\cnt by 1}{\expandafter{\righttext}}}
\def\vername{\;\;\verlabel{\myver{\cverno}}}
}
\def\fcnt{\the\cnt}
% \def\fcnt{\stagcnt}
\noindent
\underline{\hypertarget{ex:\cname}{\textit{Example \ename}}\vername}
%\vspace*{-3mm}
\code{\VerbatimInput[numbers=left,numbersep=5ex,firstnumber=1,firstline=\fcnt,fontsize=\small]%
{\chapdirname/sources/\cname}}
}
\newcommandx*\cnexample[4][1=,4=0]{%
\exampleheader{#2}{#3}{c}{7}{#4}{#1}
}
\newcommandx*\cppnexample[4][1=,4=0]{%
\exampleheader{#2}{#3}{cpp}{7}{#4}{#1}
}
\newcommandx*\fnexample[4][1=,4=0]{%
\exampleheader{#2}{#3}{f}{5}{#4}{#1}
}
\newcommandx*\ffreenexample[4][1=,4=0]{%
\exampleheader{#2}{#3}{f90}{5}{#4}{#1}
}
\newcommandx*\srcnexample[5][1=,5=0]{%
\exampleheader{#2}{#3}{#4}{0}{#5}{#1}
}
\newcommandx*\cexample[4][1=,4=0]{%
\ifccpp
\needspace{5\baselineskip}\begin{ccppspecific}
\cnexample[#1]{#2}{#3}[#4]
\end{ccppspecific}
\fi
}
\newcommandx*\cppexample[4][1=,4=0]{%
\ifccpp
\needspace{5\baselineskip}\begin{cppspecific}
\cppnexample[#1]{#2}{#3}[#4]
\end{cppspecific}
\fi
}
\newcommandx*\fexample[4][1=,4=0]{%
\iffortran
\needspace{5\baselineskip}
\begin{fortranspecific}
\fnexample[#1]{#2}{#3}[#4]
\end{fortranspecific}
\fi
}
\newcommandx*\ffreeexample[4][1=,4=0]{%
\iffortran
\needspace{5\baselineskip}
\begin{fortranspecific}
\ffreenexample[#1]{#2}{#3}[#4]
\end{fortranspecific}
\fi
}
\newcommandx*\hexentry[4][1=c,3=]{%
\hyperlink{ex:#2.#1}{\splc{#2.#1}}%
\ifthenelse{ \equal{#3}{} }{}{,~\hyperlink{ex:#2.#3}{\plc{#3}}}%
& #4%:~\splc{same name}
}
\newcommandx*\hexmentry[5][1=c,3=]{%
\hyperlink{ex:#2.#1}{\splc{#2.#1}}%
\ifthenelse{ \equal{#3}{} }{}{,~\hyperlink{ex:#2.#3}{\plc{#3}}}%
& #4:~\splc{#5.#1}\ifthenelse{ \equal{#3}{} }{}{,~\plc{#3}}
}
% Set default fonts:
\rmfamily\mdseries\upshape\normalsize
% This is the end of openmp.sty of the OpenMP specification.