Tag Info

Hot answers tagged

52

You can use the features of the colortbl package with additions of xcolor. See code below for a small example. \documentclass[11pt,a4paper]{article} \usepackage[T1]{fontenc} \usepackage[latin1]{inputenc} \usepackage[table]{xcolor} % loads also »colortbl« \begin{document} \rowcolors{2}{gray!25}{white} \begin{tabular}{cc} \rowcolor{gray!50} ...


42

After some research, I found an answer myself. This is a little bit different to the answer by Presidenten, both solutions work. The package wallpaper works well for this purpose. You need to import the package in the header: \usepackage{wallpaper} After that you can use commands like: \ThisLRCornerWallPaper{0.5}{somerights.png} ...


35

Update with minimal and maximal values Minimal values are only usable when negative values are disabled (\negativeValuesfalse). Code \documentclass{article} \usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor \usepackage{tikz,array,collcell} \usetikzlibrary{calc} \pgfdeclarelayer{background} \pgfdeclarelayer{main} \pgfsetlayers{background,main} ...


34

You can accomplish this with the wallpaper package. It has many options for creating background images that are tiled, centered, and scaled, on every page or only specific ones. In your case if the letterhead is contained in lh.pdf then you simply need \documentclass{article} \usepackage{wallpaper} \ULCornerWallPaper{1}{lh.pdf} \begin{document} Your ...


30

Write \usebackgroundtemplate before the frame, not within: \end{frame} % Now we install the new template for the following frames: \usebackgroundtemplate{% \includegraphics[width=\paperwidth,height=\paperheight]{crayons}} \begin{frame} ... \end{frame} % Now we install another template, effective from now on: \usebackgroundtemplate{...} Ensure that ...


25

The solution below defines two alternative ways of drawing a coloured gradient in the margin background on a selection of pages: Invoke the \conditionalmarginbg (which takes no argument) at the beginning of your document and then toggle the margin background on/off in your document by using the \startdrawmarginbg and \stopdrawmarginbg macros. Invoke ...


25

This solution, using nested stack insets, still has vertical height/depth to the overlay. The relative placement of the insets is controlled by the length parameters (2nd and 4th arguments of \stackinset are (x,y) offsets). \documentclass{article} \usepackage{stackengine} \usepackage{xcolor} \begin{document} \def\MyText{not scary} ...


24

Another sans-TikZ alterantive: \documentclass{article} \usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor \usepackage[nomessages]{fp}% http://ctan.org/pkg/fp \newcommand{\maxnum}{100.00} \newlength{\maxlen} \newcommand{\databar}[2][green!25]{% \settowidth{\maxlen}{\maxnum}% \addtolength{\maxlen}{\tabcolsep}% \FPeval\result{round(#2/\maxnum:4)}% ...


24

Your Google source is wrong. The PDF version of LaTeX pdflatex supports the PNG format out of the box, including transparent PNGs. If you have your logo in another format like GIF than simply convert it to PNG first. I would not recommend to use the normal latex compiler with DVI output. You need the standard package graphicx to include the image. Loaded ...


23

I used images Sir Isaac Newton (rename it as newton.jpg) and Kitten (rename it as kitten.jpg) The code snippet below is self-explanatory and I compiled using pdflatex.exe because of .jpg format. \documentclass[bigger]{beamer} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{graphicx} %Global Background must be put in preamble ...


20

Modify the background canvas before you begin the frame, not within the frame. To keep the effect of the color change local, you could use curly braces around the frame and that command, or \begingroup ... \endgroup.


19

Thanks to Andrew Stacey for pointing me to the new improved tikzmkark. I was not aware of it. This version of \tikzmark allows for using the defined coordinates before the point of its definition. Using \tikzmark{foo} a new coordinate named (pic cs:foo) is available and can be used anywhere in the page. Using the new \tikzmark, taken from the preamble of ...


19

TiKZ 3.0.0 introduces pic a "short picture" which can be inserted in any place of a tikzpicture. A possible solution with 'pic' would be: \documentclass{standalone} \usepackage[margin = 1in]{geometry} \usepackage{tikz} \usetikzlibrary{decorations.pathmorphing,calc,shapes,shapes.geometric,patterns} \begin{document} \tikzset{treetop/.style = ...


18

You can box the image and then use \vfil and \hfil to center it: \PassOptionsToPackage{demo}{graphicx} \documentclass{beamer} \usebackgroundtemplate{% \vbox to \paperheight{\vfil\hbox to \paperwidth{\hfil\includegraphics[width=1.5in]{name}\hfil}\vfil} } \begin{document} \begin{frame} Test \end{frame} \end{document} The line ...


17

You could use the \afterpage command from the afterpage package to change the color back. Here's an example: \documentclass{article} \usepackage{lipsum}% for auto generating text \usepackage{afterpage} \usepackage{xcolor} \begin{document} \lipsum[1-12] \pagecolor{yellow}\afterpage{\nopagecolor} \lipsum[22-30] \end{document}


17

\documentclass[x11names]{report} \usepackage{background} \usepackage{blindtext} \backgroundsetup{ scale=1, angle=0, opacity=1, contents={\begin{tikzpicture}[remember picture,overlay] \path [left color = Gold2,middle color = Gold2!30, right color = white] (current page.south west)rectangle (current page.north east); % Adjust the position of the logo. ...


17

Include the white frames into a group with an empty usebackgroundtemplate \documentclass{beamer} \usebackgroundtemplate% { \centering\includegraphics[width=\paperwidth,height=\paperheight{bgs/global.png} } \begin{document} \begin{frame} this frame will have the global background \end{frame} { \usebackgroundtemplate{} \begin{frame} This frame ...


16

\documentclass{beamer} \usepackage{pgf} \usepackage{pgffor} \pgfmathsetseed{\number\pdfrandomseed} % seed for random generator \setbeamertemplate{background canvas}{% \pgfmathsetmacro{\R}{random(0,10000)/10000}% \pgfmathsetmacro{\G}{random(0,10000)/10000}% \pgfmathsetmacro{\B}{random(0,10000)/10000}% \definecolor{bgcolor}{rgb}{\R,\G,\B}% ...


16

You can also use \setbeamertemplate{background} {\includegraphics[width=\paperwidth,height=\paperheight,keepaspectratio]{background.jpg}} (where background.jpg is your picture). A sample background: Code \documentclass{beamer} \setbeamertemplate{background} {\includegraphics[width=\paperwidth,height=\paperheight,keepaspectratio]{background.jpg}} ...


15

A solution with hf-tikz (requires two compilation runs): \documentclass[dvipsnames]{article} \usepackage{amsmath} \usepackage[customcolors]{hf-tikz} \definecolor{My}{RGB}{0,31,63} \definecolor{MyConst}{RGB}{128,128,128} \definecolor{MyFunc}{RGB}{0,75,107} \definecolor{MyIndep}{RGB}{127,55,0} \definecolor{MySubst}{RGB}{250,230,230} ...


15

I would define a specific key for the tree and one for the position: % to get the positions of last x,y \newdimen\xval \newdimen\yval \pgfkeys{/tikz/.cd, at/.initial={(0,0)}, at/.get=\coordpos, at/.store in=\coordpos, my tree/.code={ \foreach \w/\f in {0.3/30,0.2/50,0.1/70} { \fill [brown!\f!black, trunk] \coordpos ++(-\w/2,0) ...


15

So if I understood your question correctly, you want to do something like GitHub's markdown style. So I created some commands and environments to supply a GitHub-like style based on Adam Pritchard's Markdown Cheatsheet. I used Source Sans Pro and Source Code Pro fonts, so you'll have to download and install them on your operating system. Here are the direct ...


15

You could check for the frame number: \setbeamertemplate{background canvas}{% \ifnum\c@framenumber=1% % On title page \fi% } You may extend this to set thing to all frames except the title: \setbeamertemplate{background canvas}{% \ifnum\c@framenumber=1% % On title page \else% % Other frames background \fi% ...


13

This is for a section, but you can extend it easily for subsections with a similar scheme: \documentclass[a4paper]{scrbook} \usepackage{xcolor,lipsum} \usepackage{titlesec} \titleformat{name=\section}[block] {\sffamily\large} {} {0pt} {\colorsection} \titlespacing*{\section}{0pt}{\baselineskip}{\baselineskip} \newcommand{\colorsection}[1]{% ...


13

You can use TikZ to place the image in a \node with the desired opacity: \documentclass{beamer} \usepackage{tikz} \usebackgroundtemplate{% \tikz\node[opacity=0.3] {\includegraphics[height=\paperheight,width=\paperwidth]{ctanlion}};} \begin{document} \begin{frame} CTAN lion drawing by Duane Bibby. \end{frame} \end{document} In this case, itmight be ...


13

The credits should go to Martin Scharrer. It is possible with the listings package: \documentclass{article} \usepackage{listings,color} \definecolor{verbgray}{gray}{0.9} \lstnewenvironment{code}{% \lstset{backgroundcolor=\color{verbgray}, frame=single, framerule=0pt, basicstyle=\ttfamily, columns=fullflexible}}{} ...


13

Since (La)TeX doesn't have a “background color” for text, you would have to put your text inside a box which you can then color. Consider the following example using \colorbox. \documentclass{beamer} \setbeamercolor{alerted text}{fg=white,bg=red} \newcommand{\boxalert}[1]{{% \usebeamercolor{alerted text}\colorbox{bg}{\alert{#1}}% }} \begin{document} ...


13

Here is MWE using the background and the eso-pic package: \documentclass[dvipsnames,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[object=vectorian]{pgfornament} \usepackage{lipsum} % Comment below if you are using the eso-pic version %-------------------------------------------------------------------- ...


13

I prefer using tcolorbox thinking that in future you may want the background to be fashionable. I have given many options (which are not needed for this particular case) in the tcbset so that you can play with them to suit your needs. \documentclass{article} \usepackage[most]{tcolorbox} \tcbset{ frame code={} center title, left=0pt, ...



Only top voted, non community-wiki answers of a minimum length are eligible