我正在为一个班级创建一张备忘单,并想在这里添加一些垂直文本:
我该如何做呢?
这是我目前拥有的代码:
代码
\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{tikz}
\usepackage{rotating}
\usepackage[most]{tcolorbox}
\usepackage{float}
\advance\topmargin-1in
\advance\textheight3in
\advance\textwidth3in
\advance\oddsidemargin-1.5in
\advance\evensidemargin-1.5in
\parindent0pt
\parskip2pt
\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}
\begin{document}
\begin{multicols*}{3}
\newtcolorbox{mybox}[2][]{text width=0.97\textwidth,fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize, colbacktitle=black,enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},top=3pt,bottom=2pt,
title=#2,colback=white}
%%------------ Single Side-Band (SSB) ---------------
\hspace{-0.2cm}
\begin{minipage}{0.31\textwidth}
\begin{mybox}{Single Side-Band (SSB)}
\begin{tabular}{l l}
\begin{minipage}{4.2cm}
\vspace*{-0.3cm}
\begin{figure}[H]
\hspace*{-0.7cm}
\includegraphics[scale=0.3]{example-image-a}
%\caption{Plot Showing Animated Rotation about the x-Axis}%
\label{fig:quad_Demod}
\end{figure}
\end{minipage} &
\begin{minipage}{3.5cm}
\vspace*{-2cm}
Phase Shifting method:\\
\hspace*{-1.8cm}
$\phi_{SSB} = A_{c}[m(t)\cos 2\pi f_{c}t\mp\hat{m}(t)\sin2\pi f_{c}t]$
\end{minipage}
\end{tabular}
\vspace*{1.25cm}
Demod of SSB-SC:$=A_{c}m(t)+\underbrace{A_{c}[m(t)\cos 4\pi f_{c}t\mp \hat{m}(t)\sin4\pi f_{c}t]}_{\text{Suppressed by LPF}}$
% Text to place vertically to the right:
\vspace*{-3.8cm}
\rotatebox{270}{
%\hspace*{3cm}
{\tiny
\begin{minipage}{5cm}
\begin{align*}
\phi_{SSB} = & A_{c}[m(t)\cos 2\pi f_{c}t\mp\hat{m}(t)\sin2\pi f_{c}t] + A\cos2\pi f_{c}t, \\
= & E(t)\cos(2\pi f_{c}t + \theta(t))\\
\text{where}\quad E(t) = & A_{c}\sqrt{[A+m(t)]^{2} + [\hat{m}(t)]^{2}} \text{ and } \theta(t)=%
-\tan^{-1}\left\{ \frac{\hat{m}(t)}{A + m(t)} \right\}
\end{align*}
\end{minipage}
}
}
%
%
\end{mybox}
\end{minipage}
\end{multicols*}
\end{document}
编辑
我通过将文本放置在 minipage 环境中进行了编辑,并能够旋转文本。文本框现在出现在 tcolorbox 的左侧。如何将文本框移动到右侧,如上图所示?谢谢!
答案1
这是一个tikz
可能适合的选项。(已更新为美国信纸尺寸的纸张。)
\documentclass{article}
\usepackage[landscape,margin=0cm]{geometry}
\usepackage{mathtools}
\usepackage{amssymb,amsthm}
\usepackage{multicol}
\usepackage[most]{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{positioning}
\newtcolorbox{mybox}[2][]{width=\linewidth,fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize, colbacktitle=black, enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},top=2mm, bottom=1mm, left=1.5mm,
right=1.5mm, title=#2, colback=white}
\pagestyle{empty}
\parindent=0pt
\parskip=2pt
\begin{document}
\begin{multicols*}{3}
\begin{mybox}{Single Side-Band (SSB)}
\begin{tikzpicture}[node distance=2mm, inner sep=0pt, outer sep=0pt]
\node (image) {\includegraphics[width=2.7cm]{example-image-a}};
\node (phase) [align=center, text width=5.5cm, right=of image.north east,
anchor=north west] {
Phase Shifting method: \\
$\phi_{SSB} = A_{c}[m(t)\cos 2\pi f_{c}t\mp\hat{m}(t)\sin2\pi f_{c}t]$
};
\node [below=of image.south west, anchor=north west,text width=7.5cm] {
Demod of SSB-SC: \\
\quad$=A_{c}m(t)+\underbrace{A_{c}[m(t)\cos 4\pi f_{c}t\mp \hat{m}(t)\sin4\pi f_{c}t]}_{\text{Suppressed by LPF}}$};
\node [rotate=90, text width=8.1cm, below=of phase.south east, anchor=south
east, font=\tiny] {
\begin{align*}
\phi_{SSB} = & A_{c}[m(t)\cos 2\pi f_{c}t\mp\hat{m}(t)\sin2\pi f_{c}t] + A\cos2\pi f_{c}t, \\
= & E(t)\cos(2\pi f_{c}t + \theta(t)) \\
\text{where}\quad E(t) = & A_{c}\sqrt{[A+m(t)]^{2} + [\hat{m}(t)]^{2}} \text{ and } \theta(t)=-\tan^{-1}\left\{ \frac{\hat{m}(t)}{A + m(t)} \right\}
\end{align*}
};
\end{tikzpicture}
\end{mybox}
\end{multicols*}
\end{document}
答案2
@Joe 可能晚了一年,但我认为值得提供一个xcoffin
解决方案。
本论坛中发布的许多问题都与根据特定设计在页面中定位图形或文本材料有关:封面、标题页、投影仪幻灯片、海报、目录等。
我很欣赏这个软件包,xcoffin
因为它在一个非常简单的环境中提供了解决我遇到的大多数问题的解决方案。
随着时间的推移,我摆脱了、、、和类似geometry
的包裹。rotate
titlepage
positioning
float
xcoffin
只有少数直观的命令,可以快速组装盒子并进行微调。这对于一次性工作(我想这种情况就是如此)非常重要,例如论文或书籍封面,当您不想花时间学习一组新的命令和新软件包的不兼容性时,只需使用一次。
这个特定问题甚至比xcoffin
文档有两个原因:
它对材料相对于另一材料的相对位置没有特定要求,因此允许使用单个参考原点(在本例中为插入点)和
作为一次性工作(而不是作为模板或类),没有必要用新的长度、命令或对框宽度或高度的相对引用或不同的字体来使代码复杂化。
最后的调整可以手动完成,调整大小和位置直到获得视觉上令人满意的效果。
只需要五个棺材就可以得到所提供的材料:tcolorbox
、image-a
和三个方程式。
一个额外的盒子用于收集连接在一起的棺材并产生输出。
所提出的解决方案与页面大小及其方向无关。(例如,注释掉该geometry
包)。
我们只能希望xcoffin
终有一天会抛弃x!
\documentclass{article}
\usepackage[landscape,margin=0cm]{geometry}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage[most]{tcolorbox}
\usepackage{xcoffins}
%% from the original, not needed in this case. xcoffin will work in any case
%\usepackage{mathtools}
%\usepackage{multicol}
%\usepackage{amssymb,amsthm}
%\usepackage{tikz}
%\usepackage{rotating}
%\usepackage{float}
\pagestyle{empty}
\parindent=0pt
\parskip=2pt
\newlength{\lmargin}
\setlength{\lmargin}{1.5em}
\begin{document}
%%%%%%%% Create & Set 6 coffins
\NewCoffin\CheatSheet
\NewCoffin\borderframe
\NewCoffin\imageA
\NewCoffin\eqPSM
\NewCoffin\eqDemod
\NewCoffin\eqPhi
\SetHorizontalCoffin\CheatSheet{} %Coffin to hold the combined joined output
\SetHorizontalCoffin\imageA{\includegraphics[width=2.7cm]{example-image-a}}
\SetHorizontalCoffin\eqDemod{%
Demod of SSB-SC: $=A_{c}m(t)+\underbrace{A_{c}[m(t)\cos 4\pi f_{c}t\mp \hat{m}(t)\sin4\pi f_{c}t]}_{\text{Suppressed by LPF}}$%
}
\SetVerticalCoffin\eqPSM{186pt}{% PSM eq width =186pt
\centering Phase Shifting method:\\%
$\phi_{SSB} = A_{c}[m(t)\cos 2\pi f_{c}t\mp\hat{m}(t)\sin2\pi f_{c}t]$%
}
\SetVerticalCoffin\eqPhi{338pt}{% phi eq width =338pt
\begin{flalign*}
\phi_{SSB} &= A_{c}[m(t)\cos 2\pi f_{c}t\mp\hat{m}(t)\sin2\pi f_{c}t] + A\cos2\pi f_{c}t,\\%
&= E(t)\cos(2\pi f_{c}t + \theta(t))\\%
\text{where}\quad E(t) &= A_{c}\sqrt{[A+m(t)]^{2} + [\hat{m}(t)]^{2}} \text{ and } \theta(t)=%
-\tan^{-1}\left\{ \frac{\hat{m}(t)}{A + m(t)} \right\}%
\end{flalign*}
}
\SetHorizontalCoffin\borderframe{%
\begin{tcolorbox}[%
width=338pt+3\lmargin,% phi eq width =338pt
height=338pt+2\lmargin,% phi eq height =338pt after rotation
fontupper=\scriptsize,%
fonttitle=\bfseries\sffamily\scriptsize,%
colbacktitle=black,enhanced,%
attach boxed title to top left={yshift=-3mm,xshift=3mm},%
boxed title style={sharp corners},top=3pt,bottom=2pt,%
title=Single Side-Band (SSB),colback=white]
\end{tcolorbox}
}%
%%%%%%% Assembly
\JoinCoffins*\CheatSheet[l,b]\borderframe[l,t]
\JoinCoffins*\CheatSheet[l,b]\imageA[l,t](\lmargin, -2\baselineskip)
\JoinCoffins*\CheatSheet[l,b]\eqPSM[r,t](\lmargin+290pt, -2\baselineskip) %Demod eq width = 290pt
\JoinCoffins*\CheatSheet[l,b]\eqDemod[l,t](\lmargin, -3\baselineskip-58pt) % image A height =58pt
\RotateCoffin\eqPhi{-90}
\JoinCoffins*\CheatSheet[l,b]\eqPhi[l,b](\lmargin+290pt, -2\baselineskip)
%%%%%%%%%% Ouput
\noindent\TypesetCoffin\CheatSheet(20pt,-100pt) %20pt right & 100pt down from upper left insertion point
\end{document}
答案3
*File List*
article.cls 2018/09/03 v1.4i Standard LaTeX document class
size10.clo 2018/09/03 v1.4i Standard LaTeX file (size option)
geometry.sty 2018/04/16 v5.8 Page Geometry
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
mathtools.sty 2018/01/08 v1.21 mathematical typesetting tools
calc.sty 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
mhsetup.sty 2017/03/31 v1.3 programming setup (MH)
amsmath.sty 2017/09/02 v2.17a AMS math features
amstext.sty 2000/06/29 v2.01 AMS text
amsgen.sty 1999/11/30 v2.0 generic functions
amsbsy.sty 1999/11/29 v1.2d Bold Symbols
amsopn.sty 2016/03/08 v2.02 operator names
amssymb.sty 2013/01/14 v3.01 AMS font symbols
amsfonts.sty 2013/01/14 v3.01 Basic AMSFonts support
amsthm.sty 2017/10/31 v2.20.4
multicol.sty 2018/04/20 v1.8s multicolumn formatting (FMi)
tcolorbox.sty 2018/07/26 version 4.14 text color boxes
pgf.sty 2015/08/07 v3.0.1a (rcs-revision 1.15)
pgfrcs.sty 2015/08/07 v3.0.1a (rcs-revision 1.31)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v3.0.1a (rcs-revision 1.7)
graphicx.sty 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
pgfsys.sty 2014/07/09 v3.0.1a (rcs-revision 1.48)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2013/09/09 (rcs-revision 1.9)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
xcolor.sty 2016/05/11 v2.12 LaTeX color extensions (UK)
color.cfg 2016/01/02 v1.6 sample color configuration
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v3.0.1a (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v3.0.1a (rcs-revision 1.1)
verbatim.sty 2014/10/28 v1.5q LaTeX2e package for verbatim enhancements
environ.sty 2014/05/04 v0.3 A new way to define environments
trimspaces.sty 2009/09/17 v1.1 Trim spaces around a token list
etoolbox.sty 2018/08/19 v2.5f e-TeX tools for LaTeX (JAW)
tikz.sty 2015/08/07 v3.0.1a (rcs-revision 1.151)
pgffor.sty 2013/12/13 v3.0.1a (rcs-revision 1.25)
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
xparse.sty 2018-10-17 L3 Experimental document command parser
expl3.sty 2018-10-31 L3 programming layer (loader)
expl3-code.tex 2018-10-31 L3 programming layer
l3pdfmode.def 2018-10-31 v L3 Experimental driver: PDF mode
listingsutf8.sty 2016/05/16 v1.3 Allow UTF-8 in listings input (HO)
listings.sty 2018/09/02 1.7 (Carsten Heinz)
lstmisc.sty 2018/09/02 1.7 (Carsten Heinz)
listings.cfg 2018/09/02 1.7 listings configuration
pdftexcmds.sty 2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
stringenc.sty 2016/05/16 v1.11 Convert strings between diff. encodings (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
shellesc.sty 2016/06/07 v0.02a unified shell escape interface for LaTeX
supp-pdf.mkii
epstopdf-base.sty 2016/05/15 v2.6 Base part for package epstopdf
grfext.sty 2016/05/16 v1.2 Manage graphics extensions (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
inputenc.sty 2018/08/11 v1.3c Input encoding file
example-image-a.pdf Graphic file (type pdf)
umsa.fd 2013/01/14 v3.01 AMS symbols A
umsb.fd 2013/01/14 v3.01 AMS symbols B
***********
(非答案,但评论太长)
答案4
我复制了您的代码,但结果略有不同。因此,我对您的文档做了一些小改动,以获得类似的图像。您可以在下面看到代码:
\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{tikz}
\usepackage{rotating}
\usepackage[most]{tcolorbox}
\usepackage{float}
\advance\topmargin-1in
\advance\textheight3in
\advance\textwidth3in
\advance\oddsidemargin-1.5in
\advance\evensidemargin-1.5in
\parindent0pt
\parskip2pt
\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}
\def\clap#1{%
\hbox to0pt{\hss#1\hss}%
}
\begin{document}
\begin{multicols*}{3}
\newtcolorbox{mybox}[2][]{text width=0.97\textwidth,fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize, colbacktitle=black,enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},top=3pt,bottom=2pt,
title=#2,colback=white}
%%------------ Single Side-Band (SSB) ---------------
\hspace{-0.2cm}
\begin{minipage}{0.35\textwidth}
\begin{mybox}{Single Side-Band (SSB)}
\begin{tabular}{l l}
\begin{minipage}{4.2cm}
% \vspace*{-0.3cm}
\begin{figure}[H]
\hspace*{-0.5cm}
\includegraphics[scale=0.35]{example-image-a}
%\caption{Plot Showing Animated Rotation about the x-Axis}%
\label{fig:quad_Demod}
\end{figure}
\end{minipage} &
\begin{minipage}{3.5cm}
\vspace*{-2cm}
Phase Shifting method:\\
\hspace*{-1.8cm}
$\phi_{SSB} = A_{c}[m(t)\cos 2\pi f_{c}t\mp\hat{m}(t)\sin2\pi f_{c}t]$
\end{minipage}
\end{tabular}
\vspace*{1.25cm}
Demod of SSB-SC:$=A_{c}m(t)+\underbrace{A_{c}[m(t)\cos 4\pi f_{c}t\mp \hat{m}(t)\sin4\pi f_{c}t]}_{\text{Suppressed by LPF}}$
% Text to place vertically to the right:
\vspace*{-3.8cm}
\hfill\clap{
\rotatebox{270}{
%\hspace*{3cm}
{\tiny
\begin{minipage}{5cm}
\begin{align*}
\phi_{SSB} = & A_{c}[m(t)\cos 2\pi f_{c}t\mp\hat{m}(t)\sin2\pi f_{c}t] + A\cos2\pi f_{c}t, \\
= & E(t)\cos(2\pi f_{c}t + \theta(t))\\
\text{where}\quad E(t) = & A_{c}\sqrt{[A+m(t)]^{2} + [\hat{m}(t)]^{2}} \text{ and } \theta(t)=%
-\tan^{-1}\left\{ \frac{\hat{m}(t)}{A + m(t)} \right\}
\end{align*}
\end{minipage}
}}
}
%
%
\end{mybox}
\end{minipage}
\end{multicols*}
\end{document}
具体来说,请注意,我定义了一个新命令\clap
,它类似于\llap
或\rlap
,但可以对齐到中心。我已将此命令用于您的整个,因此我可以相对于其中心对齐,从而消除相应的宽度,这对于结果来说是不必要的。(您可以尝试用或\rotatebox
替换的效果,以理解此机制。)最后,我在前面放了一个命令,以便它与右边距对齐。\clap
\rlap
\llap
\hfill
\clap
这是处理代码的最简单方法,无需进行太多修改。作为替代方案,我建议使用tikzpicture
其他答案中推荐的环境。
我希望这有帮助!