11

I am creating a cheat sheet for a class and wanted to add some vertical text here:

enter image description here

How do I go about doing this?

Here is the code that I have thus far:

CODE

\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}

EDIT

I made an edit by placing the text in a minipage environment and I was able to rotate the text. The text box now appears to the left of the tcolorbox. How to move the text box to the right as depicted in the image above? Thanks!

  • 3
    Maybe \rotatebox[keyvals]{angle}{text}? – Sigur Oct 30 '18 at 20:53
  • I tried your suggestion \rotatebox{270}{.... but I get the error ! Missing \endgroup inserted... .Is there something else that I need to do here? Thanks! – Joe Oct 30 '18 at 22:28
  • 1
    The problem is that things are not arranged in non-overlapping rows and columns. I would put the whole thing into a tikzpicture, or a tabular with lots of \multirow and \multicolumn entries. – John Kormylo Oct 31 '18 at 13:04
  • 1
    For an example using tikzpicture with odd shapes, see tex.stackexchange.com/questions/456916/figure-like-environment/…. – John Kormylo Nov 1 '18 at 11:29
  • 1
    Use an \hfill command before \rotatebox{270} to push the rotated minipage to the right. Then you'll see overlapping text. (some vertical, some horizontal) Maybe some redesign is in order. – corporal Nov 1 '18 at 23:33
9
+50

Here's a tikz option that might suit. (Updated for US Letter size paper.)

\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}

Single Side-Band (SSB)

  • You might want to check this and see what you think: tex.stackexchange.com/q/458156/168676 – LPH Nov 3 '18 at 9:14
  • If I run your code the rotated part comes outside the box tex.stackexchange.com/questions/458156/… – David Carlisle Nov 3 '18 at 9:14
  • @DavidCarlisle, hmmm. strange. I just rechecked it on my machine and output is the same as the screen shot. Do you have any theories? If I add \listfiles the most recently updated files are the l3kernel ones updated on 2018/09/24. I run debian testing, so my files lag a little behind the latest. – David Purton Nov 3 '18 at 12:34
  • let me try a 2017 setup ... I get same (rotated text outside the box in tl2017 and tl2018) pdflatex – David Carlisle Nov 3 '18 at 12:49
  • @DavidCarlisle, does it help to get rid of the overfull boxes? Change the width of the last node from 8cm to 8.1cm and the width of the image to 3.3cm. – David Purton Nov 3 '18 at 12:55
2

Probably a year late for @Joe but I think is worth offering a xcoffin solution.

Many question posted in this forum are related with positioning graphics or text material in a page, according to a particular design: covers, title-pages, beamer slides, posters, TOC, etc.

I appreciate the package xcoffin because provides, within a very simple environment, a solution for most of my problems on those issues.

Over time I got rid of geometry, rotate, titlepage, positioning, float and similar packages.

xcoffin has only a handful of intuitive commands that allows the assembly of the boxes and the fine tuning quite fast. This is very important in the one-time jobs -- as I guess is this case --, like thesis or books covers, when you do not want to invest time in learning a new set of commands and the incompatibilities of a new package, to be used only once.

This particular problem is even easier than the example showed in the xcoffin documentation for two reason:

  1. It does not have specific requirements over the relative position of the material with respect to another, thus allowing to use a single reference origin (in this case the insertion point) and

  2. being a one time job (against to being a template or a class) there is not need to complicate the code with new lengths, commands or relative references to the boxes widths or heights, or different fonts.

The final tuning can be done manually, adjusting sizes and positions until a visually pleasant outcome is obtained.

Only five coffins are needed for the material supplied: the tcolorbox, the image-a and the three equations.

An extra box is used to collect the joined coffins and produce the output.

The proposed solution is independent of the page size and its orientation. (e.g. commenting out the geometry package).

One can only hope that xcoffin will some day abandon the 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}

Cheat Sheet

1
 *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
 ***********

(non answer, but too long for a comment)

  • 1
    OK. There are some differences. The differences are: article.cls 2014/09/29 v1.4h, size10.clo 2014/09/29 v1.4h, xparse.sty 2018-09-24, expl3.sty 2018-09-24, expl3-code.tex 2018-09-24, l3pdfmode.def 2018-09-24, inputenc.sty 2018/04/06 v1.3b – David Purton Nov 3 '18 at 13:04
  • 1
    One other thought? Page size? Force it to A4. – David Purton Nov 3 '18 at 13:05
1

I copied your code, but the results were a little different. So I made a few small changes to your document in order to obtain a similar image. You can see the code below:

\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}

Specifically, note that I have defined a new command \clap, which is similar to \llap or \rlap, but works aligning to the center. I have used this command on your whole \rotatebox, so I can align with respect to its center, eliminating the corresponding width, which is unnecessary for the result. (You can experiment the effects of replacing \clap with \rlap or \llap in order to comprehend this mechanism.) Finally, I have put a \hfill command before \clap so it aligns with the right margin.

This is the simplest way to work with your code without modifying it too much. As an alternative, I would recommend using a tikzpicture environment as recommended in the other answers.

I hope this helps!

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.