在 Beamer 类中设置侧边栏颜色(使用 xelatex)

在 Beamer 类中设置侧边栏颜色(使用 xelatex)

我想更改投影仪侧边栏的颜色,但我不知道\setbeamercolor{}{}侧边栏颜色需要哪个参数。我使用\usepackage{xcolor}并指定我自己的颜色,如下所示:\definecolor{myBlue}{RGB}{45,170,250}

我的 tex 编译器是xelatex

这是我的 tex 文件:

\documentclass{beamer}                                                          

% beamer theme                                                                  
\usetheme{Marburg}                                                              

% german spelling                                                               
\usepackage[english,ngerman]{babel}                                             

% set font encoding                                                             
\usepackage[T1]{fontenc}                                                        

% math stuff                                                                    
\usepackage{amsmath}                                                            
\usepackage{amsfonts}                                                           
\usepackage{amssymb}                                                            

% color                                                                         
\usepackage{xcolor}                                                             

% set font to Helvetica Light                                                   
\usepackage{xltxtra}                                                            
\setsansfont[Ligatures=TeX]{Helvetica Light}                                    

\title{Präsentation}                                                            
\author{Max Mustermann}                                                         
\date{\today}                                                                   

% removes navigation bar                                                        
\beamertemplatenavigationsymbolsempty                                           

\begin{document}                                                                

\begin{frame}                                                                   
    \frametitle{Ein Demotitel}                                                  
    abcdefghijklmnopqrstuvwxyz äöüß 1234567890                                  
    ABCDEFGHIJKLMNOPQRSTUVWXYZ                                                  
\end{frame}                                                                     

\end{document}

答案1

如果您想知道beamer某个主题使用了哪些颜色,请查看其定义样式文件beamerthemeMarsburg.sty。您将在那里看到:

\mode<presentation>

\usecolortheme{whale}

\setbeamercolor*{titlelike}{use=structure,fg=structure.fg}

\useoutertheme[height=0pt]{sidebar}

\setbeamercolor{sidebar}{parent=palette primary}

{\usebeamercolor{palette quaternary}}
{\usebeamercolor{palette primary}}

\setbeamertemplate{sidebar canvas \beamer@sidebarside}[vertical shading][top=palette quaternary.bg,bottom=palette primary.bg]

这意味着该主题使用颜色主题whale,并且sidebar基于vertical shading颜色palette quaternary.bgpalette primary.bg

现在你有两种选择,更改palette定义或仅更改sidebar定义。如果你想确保基于此颜色的每个模板也发生更改,则必须使用第一种。如果你只想更改侧边栏背景,只需添加

\definecolor{myBlue}{RGB}{45,170,250}
\makeatletter
\setbeamertemplate{sidebar canvas right}[vertical shading][top=palette quaternary.bg,bottom=myBlue]
\makeatother

在你的序言中。当然,如果你的侧边栏在左边,请right用进行更改left。结果如下:

在此处输入图片描述

完整代码如下:

\documentclass{beamer}                                                          

% beamer theme                                                                  
\usetheme{Marburg}                                                              

% german spelling                                                               
\usepackage[english,ngerman]{babel}                                             

% set font encoding                                                             
\usepackage[T1]{fontenc}                                                        

% math stuff                                                                    
\usepackage{amsmath}                                                            
\usepackage{amsfonts}                                                           
\usepackage{amssymb}                                                            

% color                                                                         
%\usepackage{xcolor}                                                             

% set font to Helvetica Light                                                   
\usepackage{xltxtra}                                                            
\setsansfont[Ligatures=TeX]{Tahoma}                                    

\title{Präsentation}                                                            
\author{Max Mustermann}                                                         
\date{\today}                                                                   

% removes navigation bar                                                        
\beamertemplatenavigationsymbolsempty                                           

\definecolor{myBlue}{RGB}{45,170,250}
\makeatletter
\setbeamertemplate{sidebar canvas right}[vertical shading][top=palette quaternary.bg,bottom=myBlue]
\makeatother

\begin{document}                                                                

\begin{frame}                                                                   
    \frametitle{Ein Demotitel}                                                  
    abcdefghijklmnopqrstuvwxyz äöüß 1234567890                                  
    ABCDEFGHIJKLMNOPQRSTUVWXYZ                                                  
\end{frame}                                                                     

\end{document}

笔记:

  1. 我使用 Tahoma 字体而不是原始的 Helvetica Light。
  2. beamer已加载,您可以从序言中xcolor删除。\usepackage{xcolor}

\listfiles命令结果

 *File List*
  beamer.cls    2013/12/02 3.33 A class for typesetting presentations (rcs-revi
sion 332bfd3ce558)
beamerbasercs.sty    2013/12/25 (rcs-revision 31cc758a62ae)
beamerbasemodes.sty    2013/09/03 (rcs-revision 768f2d98ca64)
beamerbasedecode.sty    2010/05/01 (rcs-revision efa082c6111d)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
beamerbaseoptions.sty    2013/03/10 (rcs-revision 47431932db0d)
  keyval.sty    2014/05/08 v1.15 key=value parser (DPC)
geometry.sty    2010/09/12 v5.6 Page Geometry
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
geometry.cfg
  size11.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
 pgfcore.sty    2010/04/11 v3.0.0 (rcs-revision 1.7)
graphicx.sty    2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
   xetex.def    2014/04/28 v4.01 LaTeX color/graphics driver for XeTeX (RRM/JK)

  pgfsys.sty    2013/11/30 v3.0.0 (rcs-revision 1.47)
  pgfrcs.sty    2013/12/20 v3.0.0 (rcs-revision 1.28)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2013/09/09  (rcs-revision 1.9)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
 pgfcore.code.tex
 xxcolor.sty    2003/10/24 ver 0.1
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
hyperref.sty    2012/11/06 v6.83m Hypertext links for LaTeX
hobsub-hyperref.sty    2012/04/25 v1.12 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2012/04/25 v1.12 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2012/04/25 v1.12 Construct package bundles (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable calculations with integers (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty    2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2012/04/08 v1.3 Expandable calculations on big integers (HO)
  bitset.sty    2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty    2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty    2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
 hopatch.sty    2011/06/24 v1.1 Wrapper for package hooks (HO)
xcolor-patch.sty    2011/01/30 xcolor patch
atveryend.sty    2011/06/30 v1.8 Hooks at the very end of document (HO)
refcount.sty    2011/10/16 v3.4 Data extraction from label references (HO)
 hycolor.sty    2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
  pd1enc.def    2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
  hxetex.def    2012/11/06 v6.83m Hyperref driver for XeTeX
   puenc.def    2012/11/06 v6.83m Hyperref: PDF Unicode definition (HO)
stringenc.sty    2011/12/02 v1.10 Convert strings between diff. encodings (HO)
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
se-ascii-print.def    2011/12/02 v1.10 stringenc: Printable ASCII characters
beamerbaserequires.sty    2010/05/01  (rcs-revision efa082c6111d)
beamerbasecompatibility.sty    2012/05/01  (rcs-revision 67c48b3b652d)
beamerbasefont.sty    2013/10/18  (rcs-revision 72f39e01808a)
 amssymb.sty    2013/01/14 v3.01 AMS font symbols
amsfonts.sty    2013/01/14 v3.01 Basic AMSFonts support
sansmathaccent.sty    2013/03/28
filehook.sty    2011/10/12 v0.5d Hooks for input files
beamerbasetranslator.sty    2010/06/11  (rcs-revision 85fd1cc7fc42)
translator.sty    2010/06/12 ver 1.10
translator-language-mappings.tex
beamerbasemisc.sty    2013/09/03  (rcs-revision a55719c41d85)
beamerbasetwoscreens.sty    2010/05/01  (rcs-revision efa082c6111d)
beamerbaseoverlay.sty    2013/12/25  (rcs-revision f6bd5e3805da)
beamerbasetitle.sty    2010/09/21  (rcs-revision f0446ed0b6ae)
beamerbasesection.sty    2013/06/07  (rcs-revision 60b9fe0f342f)
beamerbaseframe.sty    2013/10/02  (rcs-revision cdc8e9a3aaac)
beamerbaseverbatim.sty    2012/08/30  (rcs-revision dfdb135076b3)
beamerbaseframesize.sty    2011/09/12  (rcs-revision 70f9d8411e54)
beamerbaseframecomponents.sty    2013/10/18  (rcs-revision 5cf6c5555a45)
beamerbasecolor.sty    2010/06/06  (rcs-revision d1a9b48be06d)
beamerbasenotes.sty    2012/12/19  (rcs-revision 1686da3db3c9)
beamerbasetoc.sty    2013/05/23  (rcs-revision 0fdf5bc43be8)
beamerbasetemplates.sty    2010/05/01  (rcs-revision efa082c6111d)
beamerbaseauxtemplates.sty    2013/09/04  (rcs-revision 4ac715c499d0)
beamerbaseboxes.sty    2012/05/13  (rcs-revision 56972908a390)
beamerbaselocalstructure.sty    2013/09/04  (rcs-revision 4ac715c499d0)
enumerate.sty    1999/03/05 v3.00 enumerate extensions (DPC)
beamerbasenavigation.sty    2013/10/05  (rcs-revision 62be157fe783)
beamerbasetheorems.sty    2010/06/06  (rcs-revision 7e7cc5e53e9d)
 amsmath.sty    2013/01/14 v2.14 AMS math features
 amstext.sty    2000/06/29 v2.01
  amsgen.sty    1999/11/30 v2.0
  amsbsy.sty    1999/11/29 v1.2d
  amsopn.sty    1999/12/14 v2.01 operator names
  amsthm.sty    2004/08/06 v2.20
beamerbasethemes.sty    2010/05/01  (rcs-revision efa082c6111d)
beamerthemedefault.sty    2010/06/17  (rcs-revision d02a7cf4d8ae)
beamerfontthemedefault.sty    2012/12/19  (rcs-revision 1686da3db3c9)
beamercolorthemedefault.sty    2012/12/19  (rcs-revision 1686da3db3c9)
beamerinnerthemedefault.sty    2013/10/15  (rcs-revision 65cb471f9634)
beamerouterthemedefault.sty    2012/12/19  (rcs-revision 1686da3db3c9)
beamerthemeMarburg.sty    2010/06/17  (rcs-revision d02a7cf4d8ae)
beamercolorthemewhale.sty    2010/06/17  (rcs-revision d02a7cf4d8ae)
beamerouterthemesidebar.sty    2010/06/17  (rcs-revision d02a7cf4d8ae)
   babel.sty    2008/07/08 v3.8m The Babel package
 bblopts.cfg    2006/07/31 v1.0 MiKTeX 'babel' configuration
 english.ldf    2005/03/30 v3.3o English support from the babel system
ngermanb.ldf    2008/07/06 v2.6n new German support from the babel system
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
 xltxtra.sty    2010/09/20 v0.5e Improvements for the "XeLaTeX" format
fontspec.sty    2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX
   expl3.sty    2014/05/06 v4751 L3 programming layer (loader) 
expl3-code.tex    2014/05/06 v4751 L3 programming layer 
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
  xparse.sty    2014/05/05 v4740 L3 Experimental document command parser
fontspec-patches.sty    2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTe
X
fixltx2e.sty    2014/04/27 v1.1p fixes to LaTeX
fontspec-xetex.sty    2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX
 fontenc.sty
  eu1enc.def    2010/05/27 v0.1h Experimental Unicode font encodings
  eu1lmr.fd    2009/10/30 v1.6 Font defs for Latin Modern
xunicode.sty    2011/09/09 v0.981 provides access to latin accents and many oth
er characters in Unicode lower plane
 eu1lmss.fd    2009/10/30 v1.6 Font defs for Latin Modern
fontspec.cfg
realscripts.sty    2013/03/18 v0.3c Access OpenType subscripts and superscripts

metalogo.sty    2010/05/29 v0.12 Extended TeX logo macros
   t3cmr.fd    2001/12/31 TIPA font definitions
 nameref.sty    2012/10/27 v2.43 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO) 

相关内容