我在一本书中看到了一些我喜欢的布局,并且我想制作一些看起来像它的东西,但我不知道应该怎么做。
布局预期(这是分开的两页)
- 第一页
2.第二页
但我被困住了,因为我无法修复元素的位置和规则的颜色,无法让正方形的线条伸出或与填充相同。而且我不知道如何制作示例笼子(我知道那里有一个位图图案,没关系,我想用相同的颜色填充整个框)。
平均能量损失
\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}
答案1
我希望已经了解了您的(几乎)所有需求。
我把example
盒子做成了可破碎的,但如果你不希望它跨页破碎,那就省略breakable
这个选项。
我将example
标题背景设为灰色,但您也可以添加图像来重现您喜欢的背景。
另请参阅我的 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}