10

This is the first document I am working with Latex for my CV. Here, I am getting an error as follows:

! LaTeX Error: Option clash for package geometry.

\documentclass[a4paper,10pt]{article}

%A Few Useful Packages
\usepackage{marvosym}
\usepackage{fontspec}                   %for loading fonts
\usepackage{xunicode,xltxtra,url,parskip}   %other packages for formatting
\RequirePackage{color,graphicx}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage[big]{layaureo}              %better formatting of the A4 page
% an alternative to Layaureo can be ** \usepackage{fullpage} **
\usepackage{supertabular}               %for Grades
\usepackage{titlesec}%custom \section

%Setup hyperref package, and colours for links
\usepackage{hyperref}
\usepackage[letterpaper,showframe]{geometry}
\usepackage{multirow}
\usepackage{array} %for table lists
\definecolor{linkcolour}{rgb}{0,0.2,0.6}
\hypersetup{colorlinks,breaklinks,urlcolor=linkcolour, linkcolor=linkcolour}

%FONTS
\defaultfontfeatures{Mapping=tex-text}
%\setmainfont[SmallCapsFont = Fontin SmallCaps]{Fontin}
%%% modified for Karol Kozioł for ShareLaTeX use
\setmainfont[
SmallCapsFont = Fontin-SmallCaps.otf,
BoldFont = Fontin-Bold.otf,
ItalicFont = Fontin-Italic.otf
]
{Fontin.otf}
%%%

%CV Sections inspired by: 
%http://stefano.italians.nl/archives/26
\titleformat{\section}{\Large\scshape\raggedright}{}{0em}{}[\titlerule]
\titlespacing{\section}{0pt}{3pt}{3pt}
%Tweak a bit the top margin
%\addtolength{\voffset}{-1.3cm}

%Italian hyphenation for the word: ''corporations''
\hyphenation{im-pre-se}

When I googled, I realized that this error was because I had imported the same package twice. But I don't see any line in my code where geometry has been imported again. So, does this mean something else in my context? Thanks in advance.

4
  • [letterpaper] for geometry, but [a4paper] for documentclass?
    – Thruston
    Jan 27, 2018 at 19:23
  • Were they supposed to be the same? This error came up only after I changed something in the body section of the code. Until then, everything was working fine. Jan 27, 2018 at 19:27
  • 2
    welcome to tex.sx. take a closer look at your log -- maybe some earlier package silently loads geometry. that will be reported in the log, and if it's within "unclosed" parentheses, that will tell you which package it was. Jan 27, 2018 at 19:36
  • I had to remove [letterpaper]. I also had to remove the [showframe] declaration as it was reloading multirow. Jan 29, 2018 at 10:11

2 Answers 2

13

Package layaureo already loads package geometry without options. When LaTeX sees the second load request of a package, then the package is not loaded again (e.g., otherwise, \newcommand in a package would throw errors). But, LaTeX checks the options. The options, given in later load request must be a subset of the options that were used for the loading of the package. In this case, there are two new options causing LaTeX to throw an error.

Solutions:

  • Load the package with all needed options the first time.
  • Use \PassOptionsToPackage at the very begin of the document to add package options. Especially useful, if the first loading of a package is done by the class or another package.
  • Some options can also be given as global option for \documentclass. Such an options is seen by all packages.

In the case of the example, it seems that letterpaper is an error, and you just want to add option showframe. Then remove the \usepackage[letterpaper, showframe]{geometry} -- BTW, package geometry should be loaded (the layout of the document should be set) before hyperref.

Option showframe can be given this way:

\PassOptionsToPackage{showframe}{geometry}
\documentclass[a4paper, ...]{...}
...
\usepackage{layaureo}% loads package geometry
...
1
  • Thanks! This also solves a similar issue with the memoir class. Aug 26, 2021 at 7:31
3

Simply substitute the erroneous call of geometry (that is, \usepackage[letterpaper,showframe]{geometry}) with

\geometry{showframe}

The letterpaper option doesn't make sense; if you really need it, it doesn't make sense to load layaureo.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .