发布时间:2010-03-07 20:12:00
文章类别:TeX绘图
原文地址:http://blog.sina.com.cn/s/blog_5e16f1770100hhrn.html
QQ群:91940767/145316219/141877998/80300084/194770436
淘宝店:http://latexstudio.taobao.com
技巧续篇:http://latexstudio.net/
常见数学公式问题集下载

源代码:
%% Copyright 2009 Ivan Griffin
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Ivan Griffin
%
% This work consists of the files periodic_table.tex
�scription
%-----------
%periodic_table.tex - an example file illustrating the Periodic
%
%Created 2009-12-08 by Ivan Griffin. Last updated: 2010-01-11
%
%Thanks to Jerome
%-------------------------------------------------------------
\documentclass[]{article}
%%%<
\usepackage{verbatim}
%%%>
\begin{comment}
:Title: Periodic Table of Chemical Elements
\end{comment}
\usepackage{ifpdf}
\usepackage{tikz}
\usepackage[active,tightpage]{preview}
\usetikzlibrary{shapes,calc}
\ifpdf
%
\else
% Implement Outline text using pstricks if regular LaTeX->dvi->ps->pdf route
\usepackage{pst-all}
\fi
\begin{document}
\newcommand{\CommonElementTextFormat}[4]
{
\begin{minipage}{2.2cm}
\end{minipage}
}
\newcommand{\NaturalElementTextFormat
{
\CommonElementTextFormat{#1}{#2}{\LARGE {#3}}{#4}
}
\newcommand{\OutlineText}[1]
{
\ifpdf
% Couldn't find a nicer way of doing an outline font with TikZ
% other than using pdfliteral 1 Tr
%
\pdfliteral direct {0.5 w 1 Tr}{#1}%
\pdfliteral direct {1 w 0 Tr}%
\else
% pstricks can do this with \pscharpath from pstricks
%
\pscharpath[shadow=false,
\fi
}
\newcommand{\SyntheticElementTextForm
{
\ifpdf
\CommonElementTextFormat{#1}{#2}{\OutlineText{\LARGE #3}}{#4}
\else
% pstricks approach results in slightly larger box
% that doesn't break, so fudge here
\CommonElementTextFormat{#1}{#2}{\OutlineText{\Large #3}}{#4}
\fi
}
\begin{preview}
\begin{tikzpicture}[font=\sffamily, scale=0.45, transform shape]
%% Fill Color Styles
\tikzstyle{ElementFill} = [fill=yellow!15]
\tikzstyle{AlkaliMetalFill} = [fill=blue!55]
\tikzstyle{AlkalineEarthMetalFill} = [fill=blue!40]
\tikzstyle{MetalFill} = [fill=blue!25]
\tikzstyle{MetalloidFill} = [fill=orange!25]
\tikzstyle{NonmetalFill} = [fill=green!25]
\tikzstyle{HalogenFill} = [fill=green!40]
\tikzstyle{NobleGasFill} = [fill=green!55]
\tikzstyle{LanthanideActinideFill} = [fill=purple!25]
%% Element Styles
\tikzstyle{Element} = [draw=black, ElementFill,
\tikzstyle{AlkaliMetal} = [Element, AlkaliMetalFill]
\tikzstyle{AlkalineEarthMetal} = [Element, AlkalineEarthMetalFill]
\tikzstyle{Metal} = [Element, MetalFill]
\tikzstyle{Metalloid} = [Element, MetalloidFill]
\tikzstyle{Nonmetal} = [Element, NonmetalFill]
\tikzstyle{Halogen} = [Element, HalogenFill]
\tikzstyle{NobleGas} = [Element, NobleGasFill]
\tikzstyle{LanthanideActinide} = [Element, LanthanideActinideFill]
\tikzstyle{PeriodLabel} = [font={\sffamily\LARGE}, node distance=2.0cm]
\tikzstyle{GroupLabel} = [font={\sffamily\LARGE}, minimum width=2.75cm, node distance=2.0cm]
\tikzstyle{TitleLabel} = [font={\sffamily\Huge\bfseries}]
%% Group 1 - IA
\node[name=H, Element] {\NaturalElementTextFormat
\node[name=Li, below of=H, AlkaliMetal] {\NaturalElementTextFormat
\node[name=Na, below of=Li, AlkaliMetal] {\NaturalElementTextFormat
\node[name=K, below of=Na, AlkaliMetal] {\NaturalElementTextFormat
\node[name=Rb, below of=K, AlkaliMetal] {\NaturalElementTextFormat
\node[name=Cs, below of=Rb, AlkaliMetal] {\NaturalElementTextFormat
\node[name=Fr, below of=Cs, AlkaliMetal] {\NaturalElementTextFormat
%% Group 2 - IIA
\node[name=Be, right of=Li, AlkalineEarthMetal] {\NaturalElementTextFormat
\node[name=Mg, below of=Be, AlkalineEarthMetal] {\NaturalElementTextFormat
\node[name=Ca, below of=Mg, AlkalineEarthMetal] {\NaturalElementTextFormat
\node[name=Sr, below of=Ca, AlkalineEarthMetal] {\NaturalElementTextFormat
\node[name=Ba, below of=Sr, AlkalineEarthMetal] {\NaturalElementTextFormat
\node[name=Ra, below of=Ba, AlkalineEarthMetal] {\NaturalElementTextFormat
%% Group 3 - IIIB
\node[name=Sc, right of=Ca, Metal] {\NaturalElementTextFormat
\node[name=Y, below of=Sc, Metal] {\NaturalElementTextFormat
\node[name=LaLu, below of=Y, LanthanideActinide] {\NaturalElementTextFormat
\node[name=AcLr, below of=LaLu, LanthanideActinide] {\NaturalElementTextFormat
%% Group 4 - IVB
\node[name=Ti, right of=Sc, Metal] {\NaturalElementTextFormat
\node[name=Zr, below of=Ti, Metal] {\NaturalElementTextFormat
\node[name=Hf, below of=Zr, Metal] {\NaturalElementTextFormat
\node[name=Rf, below of=Hf, Metal] {\SyntheticElementTextForm
%% Group 5 - VB
\node[name=V, right of=Ti, Metal] {\NaturalElementTextFormat
\node[name=Nb, below of=V, Metal] {\NaturalElementTextFormat
\node[name=Ta, below of=Nb, Metal] {\NaturalElementTextFormat
\node[name=Db, below of=Ta, Metal] {\SyntheticElementTextForm
%% Group 6 - VIB
\node[name=Cr, right of=V, Metal] {\NaturalElementTextFormat
\node[name=Mo, below of=Cr, Metal] {\NaturalElementTextFormat
\node[name=W, below of=Mo, Metal] {\NaturalElementTextFormat
\node[name=Sg, below of=W, Metal] {\SyntheticElementTextForm
%% Group 7 - VIIB
\node[name=Mn, right of=Cr, Metal] {\NaturalElementTextFormat
\node[name=Tc, below of=Mn, Metal] {\NaturalElementTextFormat
\node[name=Re, below of=Tc, Metal] {\NaturalElementTextFormat
\node[name=Bh, below of=Re, Metal] {\SyntheticElementTextForm
%% Group 8 - VIIIB
\node[name=Fe, right of=Mn, Metal] {\NaturalElementTextFormat
\node[name=Ru, below of=Fe, Metal] {\NaturalElementTextFormat
\node[name=Os, below of=Ru, Metal] {\NaturalElementTextFormat
\node[name=Hs, below of=Os, Metal] {\SyntheticElementTextForm
%% Group 9 - VIIIB
\node[name=Co, right of=Fe, Metal] {\NaturalElementTextFormat
\node[name=Rh, below of=Co, Metal] {\NaturalElementTextFormat
\node[name=Ir, below of=Rh, Metal] {\NaturalElementTextFormat
\node[name=Mt, below of=Ir, Metal] {\SyntheticElementTextForm
%% Group 10 - VIIIB
\node[name=Ni, right of=Co, Metal] {\NaturalElementTextFormat
\node[name=Pd, below of=Ni, Metal] {\NaturalElementTextFormat
\node[name=Pt, below of=Pd, Metal] {\NaturalElementTextFormat
\node[name=Ds, below of=Pt, Metal] {\SyntheticElementTextForm
%% Group 11 - IB
\node[name=Cu, right of=Ni, Metal] {\NaturalElementTextFormat
\node[name=Ag, below of=Cu, Metal] {\NaturalElementTextFormat
\node[name=Au, below of=Ag, Metal] {\NaturalElementTextFormat
\node[name=Rg, below of=Au, Metal] {\SyntheticElementTextForm
%% Group 12 - IIB
\node[name=Zn, right of=Cu, Metal] {\NaturalElementTextFormat
\node[name=Cd, below of=Zn, Metal] {\NaturalElementTextFormat
\node[name=Hg, below of=Cd, Metal] {\NaturalElementTextFormat
\node[name=Uub, below of=Hg, Metal] {\SyntheticElementTextForm
%% Group 13 - IIIA
\node[name=Ga, right of=Zn, Metal] {\NaturalElementTextFormat
\node[name=Al, above of=Ga, Metal] {\NaturalElementTextFormat
\node[name=B, above of=Al, Metalloid] {\NaturalElementTextFormat
\node[name=In, below of=Ga, Metal] {\NaturalElementTextFormat
\node[name=Tl, below of=In, Metal] {\NaturalElementTextFormat
\node[name=Uut, below of=Tl, Metal] {\SyntheticElementTextForm
%% Group 14 - IVA
\node[name=C, right of=B, Nonmetal] {\NaturalElementTextFormat
\node[name=Si, below of=C, Metalloid] {\NaturalElementTextFormat
\node[name=Ge, below of=Si, Metalloid] {\NaturalElementTextFormat
\node[name=Sn, below of=Ge, Metal] {\NaturalElementTextFormat
\node[name=Pb, below of=Sn, Metal] {\NaturalElementTextFormat
\node[name=Uuq, below of=Pb, Metal] {\SyntheticElementTextForm
%% Group 15 - VA
\node[name=N, right of=C, Nonmetal] {\NaturalElementTextFormat
\node[name=P, below of=N, Nonmetal] {\NaturalElementTextFormat
\node[name=As, below of=P, Metalloid] {\NaturalElementTextFormat
\node[name=Sb, below of=As, Metalloid] {\NaturalElementTextFormat
\node[name=Bi, below of=Sb, Metal] {\NaturalElementTextFormat
\node[name=Uup, below of=Bi, Metal] {\SyntheticElementTextForm
%% Group 16 - VIA
\node[name=O, right of=N, Nonmetal] {\NaturalElementTextFormat
\node[name=S, below of=O, Nonmetal] {\NaturalElementTextFormat
\node[name=Se, below of=S, Nonmetal] {\NaturalElementTextFormat
\node[name=Te, below of=Se, Metalloid] {\NaturalElementTextFormat
\node[name=Po, below of=Te, Metalloid] {\NaturalElementTextFormat
\node[name=Uuh, below of=Po, Metal] {\SyntheticElementTextForm
%% Group 17 - VIIA
\node[name=F, right of=O, Halogen] {\NaturalElementTextFormat
\node[name=Cl, below of=F, Halogen] {\NaturalElementTextFormat
\node[name=Br, below of=Cl, Halogen] {\NaturalElementTextFormat
\node[name=I, below of=Br, Halogen] {\NaturalElementTextFormat
\node[name=At, below of=I, Halogen] {\NaturalElementTextFormat
\node[name=Uus, below of=At, Element] {\SyntheticElementTextForm
%% Group 18 - VIIIA
\node[name=Ne, right of=F, NobleGas] {\NaturalElementTextFormat
\node[name=He, above of=Ne, NobleGas] {\NaturalElementTextFormat
\node[name=Ar, below of=Ne, NobleGas] {\NaturalElementTextFormat
\node[name=Kr, below of=Ar, NobleGas] {\NaturalElementTextFormat
\node[name=Xe, below of=Kr, NobleGas] {\NaturalElementTextFormat
\node[name=Rn, below of=Xe, NobleGas] {\NaturalElementTextFormat
\node[name=Uuo, below of=Rn, Nonmetal] {\SyntheticElementTextForm
%% Period
\node[name=Period1, left of=H, PeriodLabel] {1};
\node[name=Period2, left of=Li, PeriodLabel] {2};
\node[name=Period3, left of=Na, PeriodLabel] {3};
\node[name=Period4, left of=K, PeriodLabel] {4};
\node[name=Period5, left of=Rb, PeriodLabel] {5};
\node[name=Period6, left of=Cs, PeriodLabel] {6};
\node[name=Period7, left of=Fr, PeriodLabel] {7};
%% Group
\node[name=Group1, above of=H, GroupLabel] {1 \hfill IA};
\node[name=Group2, above of=Be, GroupLabel] {2 \hfill IIA};
\node[name=Group3, above of=Sc, GroupLabel] {3 \hfill IIIA};
\node[name=Group4, above of=Ti, GroupLabel] {4 \hfill IVB};
\node[name=Group5, above of=V, GroupLabel] {5 \hfill VB};
\node[name=Group6, above of=Cr, GroupLabel] {6 \hfill VIB};
\node[name=Group7, above of=Mn, GroupLabel] {7 \hfill VIIB};
\node[name=Group8, above of=Fe, GroupLabel] {8 \hfill VIIIB};
\node[name=Group9, above of=Co, GroupLabel] {9 \hfill VIIIB};
\node[name=Group10, above of=Ni, GroupLabel] {10 \hfill VIIIB};
\node[name=Group11, above of=Cu, GroupLabel] {11 \hfill IB};
\node[name=Group12, above of=Zn, GroupLabel] {12 \hfill IIB};
\node[name=Group13, above of=B, GroupLabel] {13 \hfill IIIA};
\node[name=Group14, above of=C, GroupLabel] {14 \hfill IVA};
\node[name=Group15, above of=N, GroupLabel] {15 \hfill VA};
\node[name=Group16, above of=O, GroupLabel] {16 \hfill VIA};
\node[name=Group17, above of=F, GroupLabel] {17 \hfill VIIA};
\node[name=Group18, above of=He, GroupLabel] {18 \hfill VIIIA};
%% Lanthanide
\node[name=La, below of=Rf, LanthanideActinide, yshift=-1cm] {\NaturalElementTextFormat
\node[name=Ce, right of=La, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Pr, right of=Ce, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Nd, right of=Pr, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Pm, right of=Nd, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Sm, right of=Pm, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Eu, right of=Sm, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Gd, right of=Eu, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Tb, right of=Gd, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Dy, right of=Tb, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Ho, right of=Dy, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Er, right of=Ho, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Tm, right of=Er, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Yb, right of=Tm, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Lu, right of=Yb, LanthanideActinide] {\NaturalElementTextFormat
%% Actinide
\node[name=Ac, below of=La, LanthanideActinide, yshift=-1cm] {\NaturalElementTextFormat
\node[name=Th, right of=Ac, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Pa, right of=Th, LanthanideActinide] {\NaturalElementTextFormat
\node[name=U, right of=Pa, LanthanideActinide] {\NaturalElementTextFormat
\node[name=Np, right of=U, LanthanideActinide] {\SyntheticElementTextForm
\node[name=Pu, right of=Np, LanthanideActinide] {\SyntheticElementTextForm
\node[name=Am, right of=Pu, LanthanideActinide] {\SyntheticElementTextForm
\node[name=Cm, right of=Am, LanthanideActinide] {\SyntheticElementTextForm
\node[name=Bk, right of=Cm, LanthanideActinide] {\SyntheticElementTextForm
\node[name=Cf, right of=Bk, LanthanideActinide] {\SyntheticElementTextForm
\node[name=Es, right of=Cf, LanthanideActinide] {\SyntheticElementTextForm
\node[name=Fm, right of=Es, LanthanideActinide] {\SyntheticElementTextForm
\node[name=Md, right of=Fm, LanthanideActinide] {\SyntheticElementTextForm
\node[name=No, right of=Md, LanthanideActinide] {\SyntheticElementTextForm
\node[name=Lr, right of=No, LanthanideActinide] {\SyntheticElementTextForm
%% Draw dotted lines connecting Lanthanide breakout to main table
\draw (LaLu.north west) edge[dotted] (La.north west)
%% Draw dotted lines connecting Actinide breakout to main table
\draw (AcLr.north west) edge[dotted] (Ac.north west)
%% Legend
\draw[black, AlkaliMetalFill] ($(La.north -| Fr.west) + (1em,-0.0em)$)
\draw[black, AlkalineEarthMetalFill] ($(La.north -| Fr.west) + (1em,-1.5em)$)
\draw[black, MetalFill] ($(La.north -| Fr.west) + (1em,-3.0em)$)
\draw[black, MetalloidFill] ($(La.north -| Fr.west) + (1em,-4.5em)$)
\draw[black, NonmetalFill] ($(La.north -| Fr.west) + (1em,-6.0em)$)