About 🛈
Shop 🛒Shop 🛒
LaTeX 🖹
Software 💾
Books 📚
Gallery 🖺
News 📢
Contact 📧
Blog 🖋

Gallery (bib2gls) Icons Sample

Image of icons sample
This example is taken from the ‘Examples’ chapter of bib2gls's user manual.

The entries are defined in a .bib file, miscsymbols.bib. Instead of using the entry types (such as @entry) and field names (such as name) recognised by bib2gls, these entries are all defined using a custom field @icon and custom field names (icon and identifier). These can be aliased on a per-document basis to allow for greater flexibility.

The file miscsymbols.bib contains the following:

% Encoding: UTF-8

@icon{forward,
  icon={\Forward},
  icondescription={play},
  identifier={mediacontrol}
}

@icon{forwardtoindex,
  icon={\ForwardToIndex},
  icondescription={next track},
  identifier={mediacontrol}
}

@icon{rewindtoindex,
  icon={\RewindToIndex},
  icondescription={back to start of track},
  identifier={mediacontrol}
}

@icon{rewind,
  icon={\Rewind},
  icondescription={rewind},
  identifier={mediacontrol}
}

@icon{bicycle,
  icon={\Bicycle},
  icondescription={bicycle route},
  identifier={information}
}

@icon{coffeecup,
  icon={\Coffeecup},
  icondescription={caf\'e},
  identifier={information}
}

@icon{info,
  icon={\Info},
  icondescription={information centre},
  identifier={information}
}

@icon{gentsroom,
  icon={\Gentsroom},
  icondescription={Gents},
  identifier={information}
}

@icon{ladiesroom,
  icon={\Ladiesroom},
  icondescription={Ladies},
  identifier={information}
}

@icon{wheelchair,
  icon={\Wheelchair},
  icondescription={wheelchair access provided},
  identifier={information}
}

@icon{football,
  icon={\Football},
  icondescription={football stadium},
  identifier={information}
}

@icon{recycling,
  icon={\Recycling},
  icondescription={recycling centre},
  identifier={information}
}

@icon{cloud,
  icon={\Cloud},
  icondescription={cloudy},
  identifier={weather}
}

@icon{fog,
  icon={\Fog},
  icondescription={foggy},
  identifier={weather}
}

@icon{thinfog,
  icon={\ThinFog},
  icondescription={misty},
  identifier={weather}
}

@icon{hail,
  icon={\Hail},
  icondescription={hail},
  identifier={weather}
}

@icon{sun,
  icon={\Sun},
  icondescription={sunny},
  identifier={weather}
}

@icon{lightning,
  icon={\Lightning},
  icondescription={thunderstorm},
  identifier={weather}
}

@icon{suncloud,
  icon={\SunCloud},
  icondescription={overcast},
  identifier={weather}
}

@icon{raincloud,
  icon={\RainCloud},
  icondescription={rain},
  identifier={weather}
}

@icon{weakraincloud,
  icon={\WeakRainCloud},
  icondescription={drizzle},
  identifier={weather}
}

@icon{snowcloud,
  icon={\SnowCloud},
  icondescription={snow},
  identifier={weather}
}


The document aliases @icon to @symbol with entry-type-aliases={icon=symbol} and aliases the unknown fields with field-aliases.
\documentclass[a4paper]{article}

\usepackage[T1]{fontenc}

\usepackage{etoolbox}
\usepackage{marvosym}

% package conflict, need to undefine conflicting commands
\undef\Sun
\undef\Lightning

\usepackage[weather]{ifsym}

\usepackage[record,% using bib2gls
 nostyles,% don't load default styles
 postdot,% append a dot after descriptions
 stylemods={tree},% load glossary-mcols.sty and patch
 style=alttreegroup]{glossaries-extra}

\GlsXtrLoadResources[
  src={miscsymbols},
% make @icon behave like @symbol:
  entry-type-aliases={icon=symbol},
  field-aliases={
   identifier=category,
   icon=name,
   icondescription=description
  },
  replicate-fields={category=group},
  sort-field={category},
  sort-suffix={description},
  sort-suffix-marker={|},
  set-widest,
  selection=all
]

\glsxtrsetgrouptitle{information}{Information}
\glsxtrsetgrouptitle{mediacontrol}{Media Controls}
\glsxtrsetgrouptitle{weather}{Weather Symbols}

\begin{document}
\printunsrtglossaries
\end{document}


To build the document, you need to run the following commands:
pdflatex sample-textsymbols
bib2gls sample-textsymbols
pdflatex sample-textsymbols
These commands can be run from a terminal or command prompt or you might be able to run them by clicking on a button in your text editor.

Download: PDF, document source.

© 2018 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs