按照这个想法,在 LaTeX 中使用备忘录类 Boxes 进行短信对话
但是,我收到错误,即未定义的控制序列。 \outgoing 或 \incoming
代码是这样的
% universal settings
\documentclass[smalldemyvopaper,11pt,twoside,onecolumn,openright,extrafontsizes]{memoir}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[osf]{Alegreya,AlegreyaSans}
% PACKAGE DEFINITION
% typographical packages
\usepackage{microtype} % for micro-typographical adjustments
\usepackage{setspace} % for line spacing
\usepackage{lettrine} % for drop caps and awesome chapter beginnings
\usepackage{titlesec} % for manipulation of chapter titles
% for placeholder text
\usepackage{lipsum} % to generate Lorem Ipsum
%Graphics
\usepackage{verbatim}
\usepackage{graphicx}
%urls
\usepackage{url}
% backslashes for newlines \\
\usepackage{inputenc}
% for text messages
\usepackage[many]{tcolorbox}
\usetikzlibrary{shadows}
% other
\usepackage{calc}
\usepackage{hologo}
\usepackage{makecell}
\usepackage[hidelinks]{hyperref}
%bibliography
% PHYSICAL DOCUMENT SETUP
% media settings
\setstocksize{8.5in}{6.675in}
\settrimmedsize{8.5in}{6.5in}{*}
\setbinding{0.175in}
\setlrmarginsandblock{0.611in}{1.222in}{*}
\setulmarginsandblock{0.722in}{1.545in}{*}
% defining the title and the author
%\title{\LaTeX{} ePub Template}
%\title{\textsc{How I Started to Love {\fontfamily{cmr}\selectfont\LaTeX{}}}}
\title{Daft or Stupid, \\Naughty or Bad?}
\author{LMJB}
\newcommand{\ISBN}{0-000-00000-2}
\newcommand{\press}{A monumental lesson in Gaslighting...}
% custom second title page
\makeatletter
\newcommand*\halftitlepage{\begingroup % Misericords, T&H p 153
\setlength\drop{0.1\textheight}
\begin{center}
\vspace*{\drop}
\rule{\textwidth}{0in}\par
{\Large\textsc\thetitle\par}
\rule{\textwidth}{0in}\par
\vfill
\end{center}
\endgroup}
\makeatother
% custom title page
\thispagestyle{empty}
\makeatletter
\newlength\drop
\newcommand*\titleM{\begingroup % Misericords, T&H p 153
\setlength\drop{0.15\textheight}
\begin{center}
\vspace*{\drop}
\rule{\textwidth}{0in}\par
{\HUGE\textsc\thetitle\par}
\rule{\textwidth}{0in}\par
{\Large\textit\theauthor\par}
\vfill
{\Large\scshape\press}
\end{center}
\endgroup}
\makeatother
% chapter title manipulation
% padding with zero
\renewcommand*\thechapter{\ifnum\value{chapter}<10 0\fi\arabic{chapter}}
% chapter title display
\titleformat
{\chapter}
[display]
{\normalfont\scshape\huge}
{\HUGE\thechapter\centering}
{0pt}
{\vspace{10pt}\centering}[\vspace{35pt}]
% typographical settings for the body text
\setlength{\parskip}{0em}
\linespread{1.09}
% HEADER AND FOOTER MANIPULATION
% for normal pages
\nouppercaseheads
\headsep = 0.30in
\makepagestyle{mystyle}
\setlength{\headwidth}{\dimexpr\textwidth+\marginparsep+\marginparwidth\relax}
\makerunningwidth{mystyle}{\headwidth}
\makeevenhead{mystyle}{}{\textsf{\scriptsize\scshape\thetitle}}{}
\makeoddhead{mystyle}{}{\textsf{\scriptsize\scshape\leftmark}}{}
\makeevenfoot{mystyle}{}{\textsf{\scriptsize\thepage}}{}
\makeoddfoot{mystyle}{}{\textsf{\scriptsize\thepage}}{}
\makeatletter
\makepsmarks{mystyle}{%
\createmark{chapter}{left}{nonumber}{\@chapapp\ }{.\ }}
\makeatother
% for pages where chapters begin
\makepagestyle{plain}
\makerunningwidth{plain}{\headwidth}
\makeevenfoot{plain}{}{}{}
\makeoddfoot{plain}{}{}{}
\pagestyle{mystyle}
% END HEADER AND FOOTER MANIPULATION
% table of contents customisation
\renewcommand\contentsname{\normalfont\scshape Contents}
\renewcommand\cftchapterfont{\normalfont}
\renewcommand{\cftchapterpagefont}{\normalfont}
\renewcommand{\printtoctitle}{\centering\Huge}
% for text messages from smartphones
\usepackage[many]{tcolorbox}
\usetikzlibrary{shadows}
\definecolor{mybluei}{RGB}{66,134,218}
\definecolor{mygray}{RGB}{213,216,223}
\definecolor{mygreen}{RGB}{213,216,223}
\definecolor{incoming}{RGB}{206,206,206}
\definecolor{outgoing}{RGB}{186,233,95}
\definecolor{outgoingtop}{RGB}{227,242,221}
\definecolor{incomingtop}{RGB}{240,240,240}
\definecolor{pbutton}{RGB}{221,234,243}
\definecolor{bottombg}{RGB}{217,217,217}
\definecolor{bottomblue}{RGB}{86,117,142}
%\newtcolorbox[init options]{envname}[args][default]{options}
\newtcolorbox{tcbSMS}[1]{
enhanced,
arc=0pt,
outer arc=0pt,
width=10cm,
toptitle=13.6pt,
bottomtitle=13.6pt,
title={\null},
colback=mygray,
overlay={
\node[anchor=east] at (title.east) {\includegraphics[height=30pt]{figures/SMSphone}};
\node[draw=white,line width=2pt,anchor=west,inner sep=0pt] at ([xshift=5pt]title.west) (picture) {\includegraphics[height=26pt]{figures/picture}};
\node[anchor=north west,text=white,font=\Large\sffamily] at (picture.north east) (phonenumb) {#1};
\node[anchor=south west,text=black,font=\sffamily] at (picture.south east) (phonenumb) {#1};
\fill[top color=bottombg!50,bottom color=bottombg!95!black,middle color=bottombg!50] (frame.south west) rectangle ([yshift=2cm]frame.south east);
\draw[black] ([yshift=2cm]frame.south west) -- ([yshift=2cm]frame.south east);
\draw[white] ([yshift=2cm-1pt]frame.south west) -- ([yshift=2cm-1pt]frame.south east);
\node[circle,draw,fill=pbutton,inner sep=6.8pt,drop shadow={shadow xshift=0.1ex,shadow yshift=-0.2ex,opacity=.6, fill=black!70}] (plus) at ([shift={(25pt,1.4cm)}]frame.south west) {};
\draw[line width=2pt,bottomblue] ([xshift=-5pt]plus.center) -- ([xshift=5pt]plus.center)
([yshift=-5pt]plus.center) -- ([yshift=5pt]plus.center);
\foreach \Value in {-12,-9,...,12}
{
\fill[gray,opacity=0.8] ([shift={(\Value pt,-6pt)}]plus.south) circle (0.5pt);
\fill[gray,opacity=0.8] ([shift={(\Value pt,-8.5pt)}]plus.south) circle (0.5pt);
}
\node[font=\sffamily,text=gray] at ([yshift=-0.7cm]plus.south) {(160)/1};
\node[draw=bottomblue,top color=mygray!40,bottom color=mygray!40,middle color=white,line width=1pt,rounded corners=2pt,text width=5.5cm,minimum height=1.5cm,font=\Large\sffamily,text=gray,inner xsep=6pt] at ([shift={(-5pt,1cm)}]frame.south) {\rule[-0.2cm]{1pt}{0.8cm}Type to compose};
\node[draw=white,rounded corners=2pt,text width=1cm,minimum height=1.5cm,font=\Large\sffamily,text=gray!60,inner xsep=6pt,anchor=east] at ([shift={(-5pt,1cm)}]frame.south east) (send) {Send};
\draw[black!50,rounded corners=2pt] ([shift={(-\pgflinewidth,\pgflinewidth)}]send.north west) rectangle ([shift={(\pgflinewidth,-\pgflinewidth)}]send.south east);
},
boxrule=0pt, title style={top color=mybluei!80!black,bottom color=mybluei!80!black,middle color=mybluei}, bottom=3cm
}
%\newtcbox[init options]{cmd}[args][default]{options}
\newtcbox{incoming}[1]{
enhanced,
interior code={},
frame code={
\coordinate (aux1) at ([shift={(-5pt,0pt)}]frame.south west);
\filldraw[incoming,draw=black] (aux1) to[bend right] ([shift={(0pt,\BoxP)}]frame.south west) -- ([shift={(\BoxP,0pt)}]frame.south west) arc(270:230:\BoxP) to[bend left] (aux1);
\filldraw[incoming,draw=black] ([shift={(0pt,\BoxP)}]frame.south west) -- ([shift={(0pt,-\BoxP)}]frame.north west) to[out=90,in=180] ([shift={(\BoxP,0pt)}]frame.north west) -- ([shift={(-\BoxP,0pt)}]frame.north east) to[out=0,in=90] ([shift={(0pt,-\BoxP)}]frame.north east) -- ([shift={(0pt,\BoxP)}]frame.south east) to[out=-90,in=0] ([shift={(-\BoxP,0pt)}]frame.south east) -- ([shift={(\BoxP,0pt)}]frame.south west) arc(270:230:\BoxP) ([shift={(0pt,\BoxP)}]frame.south west);
\fill[incomingtop] ([shift={(2pt,-\BoxP)}]frame.north west) -- ([shift={(-2pt,-\BoxP)}]frame.north east) to[out=90,in=0] ([shift={(-\BoxP,-2pt)}]frame.north east) -- ([shift={(\BoxP,-2pt)}]frame.north west) to[out=180,in=90] cycle;
},
width=7cm,
bottom=0pt,
capture=minipage,
fontupper=\sffamily,
attach boxed title to top left,
coltitle=black,
fonttitle=\sffamily,
boxed title style={size=small,frame empty,interior empty},
title=#1,
left=2pt,
right=2pt
}
\def\BoxP{8pt}
\newtcbox{outgoing}[1]{
enhanced,
interior code={},
frame code={
\coordinate (aux1) at ([shift={(5pt,0pt)}]frame.south east);
\filldraw[outgoing,draw=black] (aux1) to[bend left] ([shift={(0pt,\BoxP)}]frame.south east) -- ([shift={(-\BoxP,0pt)}]frame.south east) arc(270:310:\BoxP) to[bend right] (aux1);
\filldraw[outgoing,draw=black] ([shift={(0pt,\BoxP)}]frame.south east) -- ([shift={(0pt,-\BoxP)}]frame.north east) to[out=90,in=0] ([shift={(-\BoxP,0pt)}]frame.north east) -- ([shift={(\BoxP,0pt)}]frame.north west) to[out=180,in=90] ([shift={(0pt,-\BoxP)}]frame.north west) -- ([shift={(0pt,\BoxP)}]frame.south west) to[out=-90,in=180] ([shift={(\BoxP,0pt)}]frame.south west) -- ([shift={(-\BoxP,0pt)}]frame.south east) arc(270:310:\BoxP) ([shift={(0pt,\BoxP)}]frame.south east);
\fill[outgoingtop] ([shift={(2pt,-\BoxP)}]frame.north west) -- ([shift={(-2pt,-\BoxP)}]frame.north east) to[out=90,in=0] ([shift={(-\BoxP,-2pt)}]frame.north east) -- ([shift={(\BoxP,-2pt)}]frame.north west) to[out=180,in=90] cycle;
},
width=7cm,
bottom=0pt,
capture=minipage,
enlarge left by=2cm,
fontupper=\sffamily,
attach boxed title to top right,
coltitle=black,
fonttitle=\sffamily,
boxed title style={size=small,frame empty,interior empty},
title=#1,
left=2pt,
right=2pt
}
% layout check and fix
\checkandfixthelayout
%\fixpdflayout
% BEGIN THE DOCUMENT
\begin{document}
\pagestyle{empty}
% the half title page
\halftitlepage
\cleardoublepage
% the title page
\titleM
%\clearpage
% copyright page
\noindent{\small{This book is a memoir. It reflects the author’s present recollections of experiences over time. Some names and characteristics have been changed, some events have been compressed, and some dialogue has been recreated. Institutions have been kept as real as possible. However, certain parts are assumptions based on the authors recollection and logical conclusions as a victim. Particular points are cited and referenced appropriately as the novel will touch on area's of legislation and law. Particular focus will also be cited when it comes to scientific research as the novel progresses. \par\vfill\noindent Paperback Edition\space\today\\ISBN\space\ISBN\\\copyright\space\theauthor. All rights reserved.\par\vfill\noindent\theauthor\space asserts the moral right to be identified as the author of this work. All rights reserved in all media. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior written permission of the author and/or the publisher.\par}}
\clearpage
% dedication
\begin{center}
\itshape{\noindent{Dedicated to the Victims of Medical Neglect, whom are routinely made to feel hypercritical... They are condescended, patronised and often have no voice. The survivors or relatives of people whom suffer, directly or indirectly through medical neglect whom are corporately, medically, legally and criminally gaslighted...}}
\end{center}
% begin front matter
\frontmatter
\pagestyle{mystyle}
preface
%\include{Preface}
% acknowledgements
% \chapter*{Acknowledgements}
\include{Preface}
% table of contents
\clearpage
\tableofcontents*
% begin main matter
\begin{tcbSMS}{dude}
{\outgoing}
\outgoing {edd...}
\incoming{10:23}{hi}
\end{tcbSMS}
% begin back matter
\bibliography{refs}
\end{document}
% END THE DOCUMENT
输出显示如下
日志文件中的错误如下
<figures/SMSphone.jpg, id=629, 150.5625pt x 150.5625pt>
File: figures/SMSphone.jpg Graphic file (type jpg)
<use figures/SMSphone.jpg>
Package luatex.def Info: figures/SMSphone.jpg used on input line 44.
(luatex.def) Requested size: 29.99939pt x 30.0pt.
<figures/picture.jpg, id=630, 169.38281pt x 169.38281pt>
File: figures/picture.jpg Graphic file (type jpg)
<use figures/picture.jpg>
Package luatex.def Info: figures/picture.jpg used on input line 44.
(luatex.def) Requested size: 25.99818pt x 26.0pt.
LaTeX Font Info: Font shape `TU/AlegreyaSans(1)/m/n' will be
(Font) scaled to size 14.4pt on input line 44.
! Undefined control sequence.
l.49 {\outgoing
}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
l.50 \outgoing
{edd...}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
l.51 \incoming
{10:23}{hi}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
File: figures/SMSphone.jpg Graphic file (type jpg)
<use figures/SMSphone.jpg>
Package luatex.def Info: figures/SMSphone.jpg used on input line 52.
(luatex.def) Requested size: 29.99939pt x 30.0pt.
File: figures/picture.jpg Graphic file (type jpg)
<use figures/picture.jpg>
Package luatex.def Info: figures/picture.jpg used on input line 52.
(luatex.def) Requested size: 25.99818pt x 26.0pt.
[111<./figures/SMSphone.jpg><./figures/picture.jpg>]
Underfull \hbox (badness 10000) in paragraph at lines 57--65
[]
由于 memoir 类,还使用 Lualatex 作为默认编译器