logo_color

BD Tech Concepts llc

notes
Transparency and colors

When including a png file with transparency, may distort the rest of the colors on the same page due to a conflict between rgb and cmyk color spaces. The methods mentioned online for fixing this color shift for lualatex are slightly out of date now with lualatex having made some recent changes.

To fix the color shift, place the following near the start of the document preamble. This code works with pdflatex, xelatex, and recent versions of lualatex. Older versions of lualatex will not need the line below which is commented as “for new versions”.

% to fix colors while transparency is in use:
\usepackage{iftex}
\ifXeTeX
        \usepackage{eso-pic}
        \AddToShipoutPicture{%
        \makeatletter%
        \special{%
        pdf: put @thispage <> >>}
        \makeatother%
        }
\else
\ifLuaTeX
        \edef\pdfpageattr {\pdfvariable pageattr}% for newer versions
        pdfpageattr {/Group << /S /Transparency /I true /CS /DeviceRGB>>}
\else% pdflatex
        \pdfpageattr {/Group << /S /Transparency /I true /CS /DeviceRGB>>}
\fi
\fi
Editor fonts

See DejaVu Markup — Font and Inconsolata LGC Markup — Font for monospaced editor fonts which have been slightly adjusted from their originals to more clearly distinguish between the various dashes, quotes, apostrophes, primes, bullet, and center dots/multiply. These fonts may be useful to anyone using a text markup language such as , Asciidoc, markdown, or pandoc, especially when marking up text where there is an important difference in meaning between the various dash lengths, or scientific literature where a prime mark should not be a quote mark.

TeX-Live installation on Linux — PATH to texbin

The “vanilla” Tex Live install recommends setting PATH to point directly to the Tex Live binaries, but some recommend an indirect symbolic link through /opt instead:

in /opt, each time a new install occurs:

ln -s /usr/local/texlive/20xx/bin/x86_64-linux /opt/texbin

in ~/.cshrc, once only:

setenv PATH $HOME/bin:/opt/texbin:$PATH

in ~/.bashrc, once only:

PATH=/opt/texbin:$PATH  (at the end)

Likewise for root’s .bashrc and .cshrc.

Multiple versions of TeX Live may be installed, selecting one at a time simply by changing the single symbolic link in /opt.

TeX-Live fonts

TeXLive has so many fonts that they can really slow down the font-selection boxes in graphics editors. Many fonts are available both as Type-1 and also OpenType or TrueType. To have Linux only use OT or TT fonts, skipping Type-1:

To keep Type-1 fonts but remove the most problematic:

Use –dry-run to preview the results, and remove –dry-run to make the changes. Run fc-cache -fsv to inform Linux of the new fonts.

Package-writing tools

Of interest to those using the .dtx format of literate programming:

Dating a package revision:

       \changes{v0.00}{2016/01/01}{\ 2016/01/01}
       

The forced space before the date causes the change log to sort the date to the front of the “General” category. While the next version is in-progress, the new version’s date can be entered as “PENDING”.

Describing packages, files, options, booleans, etc:

The doc and ltxdoc tools provide \DescribeMacro and \DescribeEnvironment which typeset the name in the margin and create index entries, both for the name of the macro or environment, and also under the category “environments” as needed. Additional tools may be useful to describe other objects:

       \newcommand{\DescType}[1]{\raggedleft{\scriptsize#1}\quad}

        \newcommand{\DescribePackage}[1]{%
        \leavevmode%
        \marginpar{\DescType{Pkg}\bfseries\textsf{#1}}%
        \index{#1 (package)}%
        \index{packages:>#1}%
        \ignorespaces%
        }
        

Similar for (operating-system) command, file, option, boolean, length, and counter, each of which will appear in the index under its own name, and also under each category. A more advanced verison of these functions is found in the dtxdescribe package, which also adds sorting objects by class.

Margin tags:

Useful to draw attention to the destination of cross-references, for example.

       \newcommand{\margintag}[1]{%
       \marginpar{\textcolor{blue!70!black}{#1}}%
       }
       
Warning tags:

To print a warning symbol and text tag in the margin:

       \makeatletter
       \newcommand{\watchout}[1][]{%
       \@bsphack%
       \marginpar{\textcolor{blue!70!black}{#1}
       \hspace*{\fill}\includegraphics[height=3ex]{symbol_warning.pdf}}
       \@esphack%
       }
       \makeatother
       
Typesetting package and environment names:

To make names for packages and environments stand out:

       \newcommand{\pkg}[1]{\textsf{#1}}
       \newcommand{\env}[1]{\texttt{#1}}
       

Likewise for brand names, Publications, acr acronyms, and so on.