4

Consider the following code:

% DOCUMENT TYPE
\documentclass[12pt,a4paper]{article}

% PACKAGES
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[margin=10pt,font=footnotesize,labelfont=bf]{caption}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{fancybox}
\usepackage{amsmath}
\usepackage{array}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{floatrow}
\usepackage{subfigure}
\usepackage{enumitem}
\usepackage{appendix}
\usepackage{listings}
\usepackage{multicol}
\usepackage{sistyle}
\usepackage{color}
\usepackage{tikz}
\usepackage{lmodern}
\usepackage{multicol}
\usepackage{seqsplit}
\usepackage[listings,skins,theorems]{tcolorbox}
\usepackage{libertine}
\usepackage[export]{adjustbox}
\usepackage[normalem]{ulem}
\usepackage[top=1.25in, bottom=1.25in, left=1.25in, right=1.25in]{geometry}
\usepackage{calc}
\usetikzlibrary{calc}
\usepackage{hyperref}

% PRESENTATION
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\hypersetup{colorlinks, citecolor=blue, filecolor=blue, linkcolor=blue, urlcolor=blue}

% DOCUMENT BEGINNING
\begin{document}
\lipsum~{}
\begin{center}
\makebox[\textwidth]{
\begin{tikzpicture}
\draw[fill=blue,line] ($(current page.west)+(1cm, 0cm)$) rectangle ($(current page.east)+(-1cm, 2cm)$);
\end{tikzpicture}
}
\end{center}
\lipsum
\end{document}
% DOCUMENT END

which produces the following output: original

I have very few knowledge with tikz. So what I would like to do is :

  • draw the rectangle without a line around it (just the blue filling)
  • create a blank shape (see below) aligned at the north west up to the south west of the rectangle
  • with the east side being an arc
  • with a transparency gradient perpendicular to the arc of 1cm

Here is the final result I want to obtain: result

How to do that with tikz?

  • The arc is not fully described. What is its radius? – Qrrbrbirlbel May 17 '15 at 16:28
  • 1
    You can clip a very simple shape with the rectangle such as \usetikzlibrary{fadings} \begin{tikzpicture} \clip[preaction={blue,fill}] (0,0) rectangle (6,1); \fill[white,path fading=circle with fuzzy edge 20 percent] circle (3cm); \end{tikzpicture} – percusse May 17 '15 at 17:26
  • @Qrrbrbirlbel I don't know the radius yet. I will test several options. – Vincent May 17 '15 at 18:21
3

In general, one can define a radial shading and try drawing a rectangle on it.

\documentclass[border=9,tikz]{standalone}
\usetikzlibrary{shadings}
\begin{document}
\pgfdeclareradialshading{arc}{\pgfqpoint{0bp}{0bp}}{%
    color(0bp)=(white);
    color(12bp)=(white);
    color(13bp)=(blue);
    color(50bp)=(blue)}

\tikz{
    \draw[shading=arc](-20,-20)rectangle(20,20);
    \draw[line width=9](0,7)rectangle(20,9);
}

Once you think the rectangle is good, change the \draw to \clip.

\tikz{
    \clip(0,7)rectangle(20,9);
    \draw[shading=arc](-20,-20)rectangle(20,20);
}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.