Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

It happens many times that I take a look at an interestingly typeset document in LaTeX, but to which I don't have the source-code to inspect the style. One such example is this one: http://philosophy.unimelb.edu.au/ajl/2011/2011_5.pdf

I know there are free services online that identify the fonts. They may be useful for simple text, but, for example, mathematics, it becomes very hard to identify the correct style.

So, my question is, what could one use to help reproducing a specific style when only having access to the final PDF?

share|improve this question
3  
Why not flatter the author into sharing his style file? –  Emre May 23 '11 at 20:52
    
Because sometimes the author is not available. Or the typesetting was done by an editor. –  Hugo S Ferreira May 23 '11 at 21:00
    
@Emre: Please add such statements as comments, not as an answer. Thanks. –  Martin Scharrer May 23 '11 at 22:35
add comment

4 Answers 4

up vote 12 down vote accepted

For fonts, you can use pdffonts:

$ pdffonts charismanie.pdf 
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
BQFNPY+TimesNewRomanPS-ItalicMT      CID TrueType      yes yes yes     59  0
UQUJMH+Centennial-Roman              CID TrueType      yes yes yes     60  0
NSOUSR+LinLibertine                  Type 1            yes yes no     137  0
NSOUSR+LinLibertine                  Type 1            yes yes no     138  0
PTKESR+LinLibertineI                 Type 1            yes yes no     143  0
TYFIDZ+CMSY10                        Type 1            yes yes no     144  0
MHUAJQ+LinLibertineB                 Type 1            yes yes no     145  0
[none]                               Type 3            yes no  no     146  0
QTAYVE+LinBiolinumB                  Type 1            yes yes no     161  0
CXJGOW+CMR12                         Type 1            yes yes no     207  0
PTKESR+LinLibertineI                 Type 1            yes yes no     285  0
PFIFSH+fourier-orns                  Type 1            yes yes no     465  0

Edit: pipitas provided a nice answer with the -f and -l options for pdffonts. In order to automate his suggestion a bit more to list fonts in a PDF, here is a little script:

#!/bin/bash

# Parse options
RANGE=0
while getopts ":ap:f:l:g:" option; do
   case $option in
      a)
         RANGE=1
         ;;
      p)
         RANGE=1
         STARTPAGE=$OPTARG
         ENDPAGE=$STARTPAGE
         ;;
      f)
         RANGE=1
         STARTPAGE=$OPTARG
         ;;
      l)
         RANGE=1
         ENDPAGE=$OPTARG
         ;;
      g)
         GREP=1
         KEYWORD=$OPTARG
         ;;
      *)
         echo "Unknown option $option"
         exit 1
         ;;
  esac
done

shift $(($OPTIND - 1))
PDF="$1"

if [ -z "$PDF" ]; then
   echo "E: You must provide a PDF file"
   exit 1
fi

PAGES=$(pdfinfo $PDF | awk '/^Pages:/ { print $2 }')


if [ $RANGE = 1 ]; then
   for p in $(seq ${STARTPAGE:-1} ${ENDPAGE:-$PAGES}); do
      echo "== Fonts on page $p/$PAGES =="
      pdffonts -f $p -l $p $PDF
   done
elif [ $GREP = 1 ]; then
   FOUND=""
   for p in $(seq ${STARTPAGE:-1} ${ENDPAGE:-$PAGES}); do
      pdffonts -f $p -l $p $PDF | grep -q "^${KEYWORD} " && \
         FOUND="$FOUND $p"
   done
   if [[ -n $FOUND ]]; then
      echo "The font $KEYWORD was found on the following pages:$FOUND"
   else
      echo "The font $KEYWORD was not found"
   fi
else
   pdffonts $PDF
fi

It is a bash script, to be used on *nix systems. Here, I saved it as showfonts.sh).

Here is what it does:

  • Without any options, it just executes pdffonts on the given PDF file;
  • The -a option (for all) does what pipitas suggested: it lists fonts on every page individually, e.g.:

    $ ./showfonts.sh -a charismanie.pdf
    
  • The -p option (for page) lists fonts on a specific page of the PDF, e.g.:

    $ ./showfonts.sh -p 15 charismanie.pdf
    
  • The -f and -l options (for first and last) are the equivalent of the same options in pdffonts (so -f 1 is equivalent to -a), e.g.:

    $ ./showfonts.sh -f 13 -l 16 charismanie.pdf
    
  • The -g option (for grep) lets you find on which pages a font is used, e.g.:

    $ ./showfonts.sh -g "LeagueGothic" charismanie.pdf
    

    It also also takes wildcards to match fonts with similar names, e.g.:

    $ ./showfonts.sh -g ".*Libertine.*" charismanie.pdf
    

This script is now committed on github: https://github.com/raphink/listpdffonts

Edit: The script now supports font subsets with -g as requested by Kurt Pfeifle. See Git repository.

share|improve this answer
2  
Nice tip -- but are there any tools suitable for identifying on which page(s) / page-locations of the pdf an object can be found? –  Mark May 24 '11 at 17:34
    
@Mark: see my answer below... –  Kurt Pfeifle Oct 22 '11 at 9:51
1  
@Mark: Thanks to pipitas' suggestion, see my edited answer, in particular option -g. –  ℝaphink Oct 22 '11 at 21:33
    
Very nice script, Raphink :-) You could put the icing on the cake by adding some more options: (1) Add a --help option. (2) Let -g also handle font subsets (which are marked by prefix to the main font name, see tex.stackexchange.com/questions/23104/… ) and print the respective messages. –  Kurt Pfeifle Nov 10 '11 at 21:10
    
@Raphink: are you considering my suggestion for you script? –  Kurt Pfeifle Dec 15 '11 at 22:04
show 6 more comments

For the fonts. If viewing in Adobe Reader, right click, Document Properties..., then Fonts.

share|improve this answer
add comment

@Mark:

If you want to know the fonts on page 3, use

pdffonts -f 3 -l 3 /path/to/pdf

(The f is for first, the l is for last page). If you want to know which font appears on which page of a 10-page PDF, use

for p in $(seq 1 10); do
    pdffonts -f ${p} -l ${p} /path/to/pdf
done

Above examples are for *nix OS. If you are on Windows, try

for %p in (1,1,10) do pdffonts -f %p -l %p
share|improve this answer
1  
Thanks for this nice suggestion. I updated my answer to take that in consideration. –  ℝaphink Oct 22 '11 at 21:12
add comment

It seems to be a in-house style for "The Australasian Journal of Logic". They require submissions as standard LaTeX documents using the article class, and the style file is not publicly available.

share|improve this answer
2  
Yes, it is... And, for the record, the main text seems to be typed in Hoefler Text (11pt, 1.1 spacing) and the Math in Euler. –  Hugo S Ferreira May 24 '11 at 1:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.