Graphics, Figures & TablesPeriodic Table inserted one \landscape page

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Finn
Posts: 6
Joined: Thu Jul 11, 2024 7:04 pm

Periodic Table inserted one \landscape page

Post by Finn »

Hello

I have to insert the periodic table of elements in an horizontal page in my \documentclass{book}.

I've find this link https://latex-cookbook.net/periodic-table/ where is it available a prety periodic table but alone in a document. This is the code provided:

\documentclass[border=10pt]{standalone}
\usepackage{pgf-PeriodicTable}
\begin{document}
\pgfPT
\end{document}

Does anyone knows how to use this resource to insert the table in my book?

Thank you

Finn

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Periodic Table inserted one \landscape page

Post by Stefan Kottwitz »

Hi Finn,

I'm the author of the LaTeX Cookbook and maintain that website.

By horizontal page, do you mean it's a landscape layout? It would make sense since the table is pretty wide. You could use \resizebox of course, but you can also specify the cell size like this:

Code: Select all

\documentclass[landscape]{book}
\usepackage{geometry}
\usepackage{pgf-PeriodicTable}
\begin{document}
\pgfPT[cell size=30pt]
\end{document}
Stefan
LaTeX.org admin
Finn
Posts: 6
Joined: Thu Jul 11, 2024 7:04 pm

Periodic Table inserted one \landscape page

Post by Finn »

Hi Stefan
Thank you very much for your quick answer! And congratulations for the LaTex Cookbook!
Yes, when I say horizontal page I mean landscape layout. But, don't want all the pages with landscape layout, just the periodic table one.

When I run this code:
\documentclass{book}
\usepackage{geometry}
\usepackage{pgf-PeriodicTable}
\usepackage{lscape}
\begin{document}
Hola como estás
\begin{landscape}
\pgfPT[cell size=32pt]
\end{landscape}
Y hola como estás
\end{document}

It's ok, and have one landscape page and the rest pages are vertical, but whe I insert this lines:

\begin{landscape}
\pgfPT[cell size=32pt]
\end{landscape}

in my large document with many pages doesn't work. I have this error message:

! Missing \endcsname inserted.
<to be read again>
\protect
l.147 \pgfPT[cell size=32pt]

Can you help me, please?

And 2. Is it possible to customize the periodic table in black and white?

Thank you
Finn
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Periodic Table inserted one \landscape page

Post by Stefan Kottwitz »

Hi Finn,
Finn wrote:but whe I insert this lines .. in my large document with many pages doesn't work
I cannot know what else is in your large document. Can you post a Infominimal working example that shows the issue? It can be the same small document with your preamble, or a copy of the document where everything unrelated is removed, as long as the error is produced. Once we can re-produce the error, we can fix it.

And use the "Code" button to format code in a post, so it can easily be tested (and fixed) by every reader here in the forum, by clicking "Run LaTeX here" and editing and running again etc.

Stefan
LaTeX.org admin
Finn
Posts: 6
Joined: Thu Jul 11, 2024 7:04 pm

Periodic Table inserted one \landscape page

Post by Finn »

Hi Stefan,

Thank yoy again for your quick answer and sorry for my unknowingness about the use of this forum, (I'm learning).

I read the minimal working example and make some test, following the suggestions. Took my large document and found where it crash. It's because the use of: \usepackage[spanish,activeacute, es-tabla]{babel} (line #8).

Here you find the code that runs ok. Don't worry about the amount of lines because almost them are "%". When I activate \usepackage[spanish,activeacute, es-tabla]{babel} (line #8) have the error message and crash.

As far as I know, this package is necesary in order to change the page header, from "Chapter" to "Tema", using this command in line#65: %\addto\captionsspanish{\renewcommand{\chaptername}{Tema}}

Thanks,
Finn

Code: Select all

\documentclass{book}

%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%XXXXXXXXXXX                                   PAQUETES USADOS
%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%\usepackage{lmodern}
%\usepackage[T1]{fontenc}
%\usepackage[spanish,activeacute, es-tabla]{babel}
%\usepackage{mathtools}
%\usepackage{mathrsfs}
%\usepackage{amsfonts}
%\usepackage{amssymb, amsmath, amsbsy}	%Símbolos matemáticos y de flechas

\usepackage{geometry}				% Dimensiones del papel y configuración de la página.
\usepackage[nouppercase]{scrlayer-scrpage} % Configuración de la página, encabezados y eso. Creo


\usepackage{lscape}			% Permite poner una página en horizontal
\usepackage{pgf-PeriodicTable}		% Tabla periódica
%\usepackage{marvosym}		% Marcado CE
\usepackage{graphicx}			% Importación de figuras
\usepackage{epstopdf}			% Importación de figuras
%\usepackage{subfigure}			% Creacion de subfiguras con a) y b)
%\usepackage{psfrag}			% Permite modificar el texto de las imágenes
%\usepackage{float}		 	% Permite ubicar una figura con [H] de "here"


%\usepackage{pgfplots}			% Gráficos
%\usepackage{tikz}			% Gráficos
%\usepackage{chngcntr}			% Notas al pie de página. \counterwithout{footnote}{chapter} y \counterwithin{footnote}								{chapter} configuran si se renumeran las notas cada capítulo.

%\usepackage{multirow, array} 		% para trabajar con tablas y matrices
%\usepackage{enumerate}
%\usepackage{enumitem, changepage} % modifica la separación en vertical de una lista 
%\usepackage{ulem}			% para formato de letra, por ejemplo tachar
%\usepackage{makeidx}
%\usepackage{wasysym} 		% para centavo y pormil. No tiene \micro
%\usepackage{upgreek}
%\usepackage{xfrac} 			% para poner fracciones 1/2 pequeñas
%\usepackage{longtable} 		% para hacer una tabla que pase varias páginas, para el índice de acrónimos
%\usepackage{multicol} 			% permite hacer secciones a varias columnas dentro del texto
%\usepackage{wrapfig} 			% Permite insertar imágenes junto con el texto.

% CONFIGURACION DE GRÁFICOS
%______________________________________________________________-
%\usepgflibrary{shapes.arrows} 
%\pgfplotsset{compat=1.16}
%\usetikzlibrary{arrows, arrows.meta, backgrounds, calc, 3d, decorations.markings}
%\tikzset{every picture/.append style={
%					execute at begin picture={\deactivatequoting},
%					execute at end picture={\activatequoting}}}

% DIMENSIONES DEL PAPEL
%________________________________________________________________
\geometry{paperwidth = 170mm, paperheight = 240mm,
		 ignoreall, marginpar = 0cm,
 		top = 25mm, bottom = 23mm,
 		left = 17mm, right = 17mm} % Puede ser de utilidad esta herramienta \usepackage{showframe}


% PARA RENOMBRAR EL ENCABEZADO DE LAS PÁGINAS, PARA QUE APAREZCA "Tema" EN VEZ DE "Capítulo".
% Para usar estos comandos hay que tener el paquete \usepackage[spanish,activeacute, es-tabla]{babel}
% También se puede puede utilizar \renewcommand{\partname}, pero no sé de qué manera
%________________________________________________________________
%\addto\captionsspanish{\renewcommand{\chaptername}{Tema}}


% OTRAS CONFIGURACIONES GENERALES DEL DOCUMENTO
%________________________________________________________________
\pagestyle{scrheadings}				% Configuración de la página, encabezados y eso. Creo
\setlength{\headheight}{1.1\baselineskip}	% Configuración de la página, encabezados y eso. Creo

\epstopdfsetup{outdir=./}			% Ubicación de las imágenes importadas

\makeindex						% Crea el índice alfabético. Hay que ponerlo antes de \begin{document}. Con el 								comando \printindex se indica dónde aparece ubicado

%·········································································································································
%········BEGIN  DOCUMENT·············BEGIN  DOCUMENT···········BEGIN  DOCUMENT······BEGIN   DOCUMENT······
%·········································································································································
\begin{document}

\chapter{Comienzo del capítulo}
\section{Esto es el principio}
Hola, ¿como estás?

\begin{landscape}
\pgfPT[cell size=28pt]
\end{landscape}

\section{Esto es el final}
Todo va perfecto, vamos bien con la ayuda de Stefan. If you read this, suposse you found I'm spanish.


\end{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Periodic Table inserted one \landscape page

Post by Stefan Kottwitz »

Hi Finn,

that's a very good example that can be tested and shows the LaTeX error. So I suggest a quick fix: adding the babel option es-lcroman fixes the error:

Code: Select all

\usepackage[spanish,activeacute, es-tabla, es-lcroman]{babel}
That's because spanish babel changes lowercase Roman numerals to a small caps variant, and lcroman (lowercase Roman) disables that redefinition which causes an error here. Of course, just if you can live with that option and you don't get undesired lowercase Roman numerals elsewhere.

Stefan
LaTeX.org admin
Finn
Posts: 6
Joined: Thu Jul 11, 2024 7:04 pm

Periodic Table inserted one \landscape page

Post by Finn »

Yeeeees!!! Thank you Stefan :D
Post Reply