%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PAQUETES IMPORTADOS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage[T1]{fontenc}      % Percorrido de tiles
\usepackage[utf8x]{inputenc}  % Codificación UTF-8
\usepackage[galician]{babel}  % Idioma
\galiciandecimal{.}           % Distingue ./, en $$ 

\usepackage[top=2.5cm,        % Marxes
left=2cm, right=2cm, 
bottom=2cm]{geometry}

\usepackage[pdftex]{graphicx} % Gráficos
\usepackage{amsmath, amssymb, bm, textcomp, amsthm, amsfonts, yhmath}
\usepackage{ifpdf}            % Convertir imaxes .eps en .pdf
\ifpdf
  \usepackage{epstopdf}
\fi
\usepackage{wrapfig}          % Imaxes
\usepackage{longtable}        % Táboas
\usepackage{enumerate}        % Formato [] en listaxes
\usepackage{fancyhdr}         % Formato
\usepackage{setspace}         % Cambios de interliñado no medio dun texto
\usepackage{eurosym}          % Símbolo euro
\usepackage{pdfpages}         % Insertar páxs. externas
\usepackage{subfigure}        % Subfiguras
\usepackage{booktabs}         % Estilo táboas
\usepackage{cancel}           % Para tachar texto 
\usepackage{array, multirow}  % Engade opcións ás táboas
\usepackage[hyphens]{url}     % Enlaces a URLs
\usepackage{multicol}         
\usepackage[neverdecrease]{paralist} % Aliñar multicols que saen defectuosos
\usepackage{float}            % Flotantes
\usepackage{lastpage}         % Páx. # do total
\usepackage{xparse}           % Definir comandos con nº de argumentos variable
\usepackage[all]{xy}          % Graficar en 3D
\usepackage{pgfplots}         % TIKZ
\usepackage{relsize}          % Tamaño fontes
\usepackage{color,tcolorbox}  % Cor
%\usepackage{vmargin}         
%\usepackage{mathptmx}        % Times New Roman 
\usepackage{pifont}           % Todos os \ding para listas
\usepackage{schemata}         % Esquemas con chaves
\usepackage{calc}             % Caixa con texto para exercicios de completar       

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CREACIÓN ENCABEZADO E PÉ DE PÁXINA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\pagestyle{fancy}
\lhead{\ExData}
\chead{\Materia}
\rhead{\ExAvProba}
\lfoot{\Centro}
%\cfoot{}
\rfoot{\Paxina}

\renewcommand{\headrulewidth}{0.4pt}  % Liña para o encabezado
\renewcommand{\footrulewidth}{0.4pt}  % Liña para o pé
\renewcommand{\baselinestretch}{1}    % Espazo entre liñas 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEFINICIÓN DE COMANDOS (ENCABEZADO/FORMATO)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Para o pé/cabeceira do exame
\newcommand{\ExData}{Curso X}
\newcommand{\Materia}{Matemáticas - Nivel X}
\newcommand{\Centro}{IES X}
\newcommand{\Paxina}{Páx. \thepage\ de \pageref{LastPage}}	 

% Información sobre o exame
\newcommand{\ExDatos}{\makebox[0.8\textwidth]{\textbf{Nome e apelidos:}~\hrulefill} \textbf{Nota:}~\hrulefill}

%% Información para dar ao alumnado
\newcommand{\informacion}[1]{
\begin{center}
\fbox{\fbox{\parbox{\textwidth}{{\normalsize#1}}}}
\end{center}
\vspace{5mm}}

%% Escribir a puntuación: \p{puntos}
\newcommand{\p}[1]{\textbf{(#1 p)}}

%% Numeración de exercicios, teoremas, exemplos...
% \newtheorem{teorema}{Teorema}
% \newtheorem{prop}{Proposición}
% \newtheorem{lema}{Lema}
% \newtheorem{corolario}{Corolario}
\theoremstyle{definition}     % Con este estilo non é en cursiva
\newtheorem{ex}{}
% \newtheorem{exercicio}{Exercicio}
% \newtheorem*{exerciciosen}{Exercicio}
% \newtheorem{problema}{Problema}
% \newtheorem*{problemasen}{Problema} 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEFINICIÓN DE COMANDOS (ATALLOS)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% \newcommand{\R}{\mathbb{R}}             % Números reais
% \newcommand{\Q}{\mathbb{Q}}             % Números racionais
% \newcommand{\I}{\mathbb{I}}             % Números irracionais
% \newcommand{\Z}{\mathbb{Z}}             % Números enteiros
% \newcommand{\N}{\mathbb{N}}             % Números naturais
% \newcommand\op[1]{{\rm op}\left(#1\right)}
% \newcommand\abs[1]{\left|#1\right|}     % Valor absoluto
% \newcommand\ddfrac[2]{\frac{\displaystyle #1}{\displaystyle #2}} % Obrigar a que as fraccions sexan grandes
% \newcommand\raiz[2]{\sqrt[\leftroot{-2}\uproot{2} #1]{#2}}     
% \newcommand{\grad}[1]{#1^{\circ}}       % Grados