Hot answers tagged

79

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} ...


52

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} ...


43

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 ...


39

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} ...


36

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 ...


35

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 ...


34

I know this question has been answered very extensively. But not what I wanted or thought was the question based on the title. Therefore if others get in here looking for a possibility for colouring behind a word than this snippet is much easier: \colorbox{blue!30}{blue} or \textcolor{blue!30}{blue} resulting in: This is possible by only adding ...


29

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}


27

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.


27

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 ...


26

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 ...


26

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 ...


25

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)}% ...


25

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 = ...


25

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, ...


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

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}} ...


24

\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. ...


22

\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}% ...


20

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 ...


19

You can use \rowcolor, \columncolor, and \cellcolor from the colortbl package, loaded in my example through the xcolor package: \documentclass{article} \usepackage{amsmath} \usepackage[table]{xcolor} \newcommand\x{\times} \newcommand\y{\cellcolor{green!10}} \begin{document} \begin{equation}\label{eq:appendrow} \left(\begin{array}{cccc} ...


19

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 ...


18

To circumvent the issue of \nopagecolor being only available for pdfTeX and LuaTeX, you could use the pagecolor package and \newpagecolor{yellow} to set the new page color and \restorepagecolor to restore the pagecolor to the one it was before \newpagecolor{yellow} was used. If that color was white, it is white again, if it was none, it is none again, and if ...


18

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% ...


18

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 ...


17

This can easily be achieved using xcolor. It is explained at Wikibooks, you just add the table option to \usepackage{xcolor} and in the table itself you put \rowcolors{1}{color-1}{color-2}


17

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 ...


17

Solution without TikZ Using text as clip path is supported by package pdfrender if pdfTeX (or LuaTeX) is running in PDF mode. \pdfsave and \pdfrestore saves and restores the current graphics state, thus that the clipping ends after \pdfrestore. Since the graphics state include the current transfer matrix (e.g., the current point on the PDF page), the ...


16

This is a slightly tweaked solution based on Mark Wibrow's answer. It adds the fit library so that the front node (the one with the text) stretches to cover the background image without having to set the size manually. This is the image source (place it in your Tex folder where the main document is, and rename it vegetation). Output Code ...



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