Showing posts with label LaTeX. Show all posts
Showing posts with label LaTeX. Show all posts

Thursday, December 24, 2020

Flowing Fix: Including Computations in LaTeX

Below are two options for embedding coding into LaTeX files that can be executed and update values in the LaTeX file.


Monday, August 12, 2019

Flowing Fix: Installing garamondx font (and other non free fonts) on Mac

To install the Garamondx font on TexLive distribution for Mac (not include in TexLive utility) do the following:

1) download the getnonfreefonts script from https://tug.org/fonts/getnonfreefonts/install-getnonfreefonts  and save it to an arbitrary folder on the desktop

2) Open terminal and cd into the folder where you saved the getnonfreefonts script

3) run the script via terminal line by entering:  sudo texlua install-getnonfreefonts

4) check the install by typing:  getnonfreefonts --help

5) check the status of fonts on the system by typing:  getnonfreefonts -l

6) install garamondx font by typing:  getnonfreefonts garamondx

7) check install status by typing: getnonfreefonts -l

Monday, July 8, 2019

Flowing Fix: Mathpix Snipping Tool

There are times when you need to replicate an equation or block of text from a PDF file. If the PDF file was converted from a typed file, chances are that the text in the PDF can be selected. However, for equations (and if the PDF is image-based), you were out of luck, until now. Mathpix Snipping Tool is perfect for capturing a screenshot of the equation or text and automatically converts it to LaTeX. It is almost magical, capable of converting typed and handwritten information to LaTeX.
Download Mathpix Snipping Tool for MS Windows, macOS, and Ubuntu from https://mathpix.com/

Monday, July 4, 2016

Thursday, June 23, 2016

Flowing Fix: Biber fails with error missing "recode_xdata.xml"

In short, the cache files are corrupted and need to be removed. Delete the cache folder with the files and compile the document again.

You can find the cache folder path by looking in .blg file or by using the command:  biber --cache

For more information see instructions at the following link:
http://tex.stackexchange.com/questions/140814/biblatex-biber-fails-with-a-strange-error-about-missing-recode-data-xml-file

Wednesday, November 7, 2012

Generate LaTeX tables from CSV files (Excel)

via: http://texblog.org/2012/05/30/generate-latex-tables-from-csv-files-excel/
Generate LaTeX tables from CSV files (Excel):
Besides various online services and scripts, there are several LaTeX packages that generate tables directly from CSV (comma separated value) files. The advantage is everything is in the tex-file in one place and one doesn’t have to switch back and forth between website/script and LaTeX when changes are made. The drawback clearly is their limited flexibility or high complexity for sophisticated tables.
Note, I used the following few lines of code to generate a simple CSV file using LaTeX. All examples assume the existence of the file “scientists.csv”. Just copy the code into a tex-file and typeset.
\documentclass{minimal}
\begin{filecontents*}{scientists.csv}
name,surname,age
Albert,Einstein,133
Marie,Curie,145
Thomas,Edison,165
\end{filecontents*}
The star suppresses additional information on the file creation from being added.
Let’s start with a simple package.


Package csvsimple
Here is a very basic example. Elements of the first row are considered column titles. To separate them from the table content, a horizontal line is automatically added in between.
\documentclass{article}
\usepackage{csvsimple}
\begin{document}
\csvautotabular{scientists.csv}
\end{document}

The command csvreader provides a better control of the column style, titles and content, but makes things slightly more complicated.
Here is an example:
\documentclass{article}
\usepackage{csvsimple}
\begin{document}
\csvreader[tabular=|l|l|c|,
 table head=\hline & Name & Age\\\hline,
 late after line=\\\hline]%
{scientists.csv}{name=\name,surname=\surename,age=\age}%
{\thecsvrow & \firstname~\name & \age}%
\end{document}

The first part of the optional argument controls the alignment of the content per column (tabular). The second sets the column titles and adds a horizontal line before and after them (table head). Finally, another horizontal line is added to the end of the table (late after line). Furthermore, “commands” are defined for every column using the column title from the CSV file (name, surname and age). These commands allow reordering and combining column content. The command thecsvrow is a row counter and therefore an easy way to enumerate the rows.
Here is the complete package documentation.


Package pgfplotstable
A more flexible package is pgfplotstable (package documentation). It allows generating tables from different data files types. However, we will only consider CSV files here.
Again, an optional argument serves to customize what the table looks like, using key-value-pairs. Here is a minimal example with the file generated earlier. A simple example without anything special is quite complicated:
\documentclass{article}
\usepackage{pgfplotstable}
\begin{document}
\pgfplotstabletypeset[
 col sep=comma,
 string type,
 columns/name/.style={column name=Name, column type={|l}},
 columns/surname/.style={column name=Surname, column type={|l}},
 columns/age/.style={column name=Age, column type={|c|}},
 every head row/.style={before row=\hline,after row=\hline},
 every last row/.style={after row=\hline},
 ]{scientists.csv}
\end{document}

One of the things that makes this package interesting is, it supports multicolumn.
\documentclass{article}
\usepackage{pgfplotstable}
\begin{document}
\pgfplotstabletypeset[
 col sep=comma,
 string type,
 every head row/.style={%
  before row={\hline
   \multicolumn{2}{c}{Full Name} & \\
  },
  after row=\hline
 },
 every last row/.style={after row=\hline},
 columns/name/.style={column name=Name, column type=l},
 columns/surname/.style={column name=Surname, column type=l},
 columns/age/.style={column name=Age, column type=c},
 ]{scientists.csv}
\end{document}

Furthermore, the package allows generation of multi-page tables with longtable (package documentation) with pgfplotstable (see the package documentation for more details).


The csvsimple as well as the pgfplotstable package documentations are both comprehensive and very nicely formatted. It seems, the authors put in quite a bit of effort writing them. Check it out!


Further packages and other approaches
Other packages that I will not discuss here include:

Friday, May 11, 2012

Including pages from PDF documents in a LaTeX documents

via http://texblog.org/: Including pages from PDF documentsBy tom

The package pdfpages let’s you include a complete PDF or any combination of pages into a LaTeX document.

First load the package in the preamble.
\usepackage{pdfpages}

Now use any of the possible options below to include pages from a PDF.

Include the first page
\includepdf{file}

The whole document
\includepdf[pages=-]{file}

A forward or backward range
\includepdf[pages=2-8]{file}
\includepdf[pages=8-2]{file}
\includepdf[pages=last-1]{file}

You never know when that may come in handy. However, the keyword last actually can be quite useful in case the number of pages in the document may change.

Several single pages with/without blanks
\includepdf[pages={3, 6, 1}]{file}
\includepdf[pages={3, {}, 9}]{file}

Copies of the same page
\includepdf[pages={5, 5, 5}]{file}

And finally, a bit of everything
\includepdf[pages={3-6, {}, 1, 7}]{file}

The package also provides the option nup=axb to print several logical pages on a single physical page (the parameter a being the number of columns and b the number of rows). LaTeX scales the logical pages to fit within the margin of the physical page. In the example below the first 4 logical pages will be placed on the first physical page and the rest on the next.

\includepdf[nup=2x2, pages=1-7]{file}

Pdfpages package documentation.


Friday, January 20, 2012

Flowing Fix: How to easily determine the LaTeX code for a symbol

Every have trouble remember the code to a LaTeX symbol?

Typically when you want to find an infrequently used symbol in LaTeX you often have to refer to the comprehensive symbols list: http://ctan.math.utah.edu/ctan/tex-archive/info/symbols/comprehensive/symbols-letter.pdf. However, this can be time consuming and difficult to find the symbol you need.

Detexify can help find the code to LaTeX symbols simply by drawing what they look like.  Try it out for yourself, and you will shortly have a new bookmark for Detexify in your browser.

Detexify - LaTeX symbol classifier website
http://detexify.kirelabs.org/classify.html

There is also versions for mobile devices
iOS: http://itunes.apple.com/us/app/detexify/id328805329?mt=8
Android: https://market.android.com/details?id=coolcherrytrees.software.detexify&hl=en