3

I see some layout in a book that I liked, and I'm trying to make something that looks like it, but I'm unaware of how it should be done.

Layout intended (these are two pages separated)

  1. First page

enter image description here

2.Second page

enter image description here

But I'm stuck, since I can't fix the location of the elements, and the color of the rule, can't get the line of the square to go out or be the same as the fill. And I have no idea about making the example cages (I'm aware there is a bitmap pattern there, it doesn't matter, I wanted the same color to fill all the box).

MWE

\documentclass[12pt]{article}
\usepackage[sc]{mathpazo}
\usepackage{helvet}
\usepackage{courier}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr,xcolor}
\usepackage[dvipsnames]{xcolor}
\definecolor{color1}{HTML}{a5d2be}
\usepackage[letterpaper]{geometry}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,calc}
\geometry{verbose,tmargin=1.5cm,bmargin=1.5cm,lmargin=1.5cm,rmargin=1.5cm}
\setcounter{tocdepth}{2}
\usepackage{color}


\usepackage{float}
\makeatletter


\begin{document}

\copypagestyle{mystyle}{ruled}

\makeheadfootruleprefix{mystyle}{\color{Bittersweet}}{\color{PineGreen}}
\makeheadrule{mystyle}{\textwidth}{\normalrulethickness}

\begin{tikzpicture}
  \draw[fill=color1] (0, 0) rectangle (2, 2);
  \path
    (0, 0) node[below left] {}
    (2, 0) node[below right] {}
    (2, 2) node[above right] {}
    (0, 2) node[above left] {}
  ;
\end{tikzpicture}
\rule[0.5ex]{1\columnwidth}{1pt,color=color1}
\end{document}

enter image description here

3
  • 1
    1) Don't load xcolor twice 2) Is your actual class article? I'm asking it because \copypagestyle is a memoir command.
    – CarLaTeX
    Commented Nov 26, 2021 at 6:33
  • Hum... to be fair I have always used \copypagestyle in this way, so I was thinking this is from the article family. But indeed, the intended classis article.
    – riccs_0x
    Commented Nov 26, 2021 at 17:48
  • \copypagestyle gives Undefined control sequence. with article class
    – CarLaTeX
    Commented Nov 26, 2021 at 20:11

1 Answer 1

4

I hope to have understood (almost) all your needs.

I did the example box breakable, but if you would like it not to break across pages, just leave out breakable option.

I did the example title background gray, but you can also add an image, to reproduce the background you like.

Look also at the comments in my MWE:

\documentclass[12pt, twoside]{article}
\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc}%<--- no more needed since April 2018
\usepackage[letterpaper]{geometry}
%\geometry{verbose,tmargin=1.5cm,bmargin=1.5cm,lmargin=1.5cm,rmargin=1.5cm}%<--- Are you sure of these dimensions? They don't correspond to the pictures of your posted
\geometry{verbose,tmargin=3cm,bmargin=2cm,lmargin=2cm,rmargin=2cm, nomarginpar}

\usepackage[sc]{mathpazo}
\usepackage{helvet}
\usepackage{courier}
%\usepackage{fancyhdr,xcolor}<-- Load xcolor only once
\usepackage[dvipsnames]{xcolor}
\definecolor{color1}{HTML}{A5D2BE}
\colorlet{mygreen}{green!50!black}

\usepackage{float}

%\usepackage{tikz}
%\usetikzlibrary{shapes,arrows,positioning,calc}
\setcounter{tocdepth}{2}
%\usepackage{color}<--- You already loaded xcolor

% Page numenber layout
\usepackage{eso-pic}
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}
\newlength{\myheight}
\newlength{\mywidth}
\setlength{\mywidth}{\paperwidth}%
\addtolength{\mywidth}{-2cm}%
\AddToShipoutPictureBG{%
      \setlength{\myheight}{\paperheight}%
      \addtolength{\myheight}{-2cm}%
      \ifnumodd{\thepage}{%
          \textcolor{mygreen}{\rule[\myheight]{2cm}{2cm}}%
          \addtolength{\myheight}{.7cm}%
          \hspace*{-1cm}%
          \raisebox{\myheight}{\makebox[0pt]{\textcolor{white}{\bfseries\thepage}}}%
          \hspace*{1cm}%
      }{%          
          \rule{\mywidth}{0cm}\textcolor{mygreen}{\rule[\myheight]{2cm}{2cm}}%
          \addtolength{\myheight}{.7cm}%
          \hspace*{-1cm}%
          \raisebox{\myheight}{\makebox[0pt]{\textcolor{white}{\bfseries\thepage}}}%
          \hspace*{1cm}%
      }%
}
% Section layout
\usepackage{titlesec}
\titleformat{\section}{\normalfont\huge\bfseries\color{mygreen}}{\thesection}{1em}{}[{\titlerule[2pt]}]
\titleformat{\subsection}{\normalfont\Large\bfseries\color{mygreen}}{\thesubsection}{1em}{}[{\titlerule[2pt]}]

% Caption layout
\usepackage[%
  labelfont=bf,labelsep=period,
  ]{caption}
\DeclareCaptionFormat{myformat}{\color{mygreen}\titlerule[2pt]\newline#1#2#3}
\captionsetup[figure]{singlelinecheck=off,format=myformat, name=FIGURE, width=.7\textwidth}

% Example layout
\newcommand{\solution}{\par\vspace{4pt}\textcolor{mygreen}{\textbf{SOLUTION}}\par}

\usepackage[most]{tcolorbox}
\tcbuselibrary{breakable}

\tcbset{
    fonttitle=\bfseries,
    parbox=false,
    extitle/.style={adjusted title={\bfseries EXAMPLE~\thetcbcounter\ifstrempty{#1}{\ignorespaces}{~#1}}}}

\newtcolorbox[auto counter, number within=section]{example}[1][]{%
    colback=color1,colframe=lightgray,
    coltitle=mygreen,
    fonttitle=\bfseries,
    fontupper=\small,
    before skip = 8pt plus 2pt minus 2pt,
    before upper={\parindent0pt},
    enhanced jigsaw,
    breakable,
    sharp corners,
    extitle={},
    #1
}


\usepackage{lipsum}%<--- for testing purpose only

\begin{document}
\section{Are you sure you want an article?}
From you image it seems you need a book or a report.
\subsection{Introduction}
\lipsum[1]%<--- for testing purpose only
\begin{figure}[h]
    \centering
    \caption{}\label{fig:my_label}
    \includegraphics{example-image-duck}
\end{figure}
\lipsum[1]%<--- for testing purpose only
\begin{example}
\lipsum[1]%<--- for testing purpose only
\solution
\lipsum[1]%<--- for testing purpose only
\end{example}
\lipsum[1]%<--- for testing purpose only
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .