4

I have a plain vebatim environment. Questions 1, 2 are too complex to understand. I would simply like to align in the center and rescale the ascii art logo. MWE:

 \documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum, caption}  

\begin{document}
\begin{figure}[!b]
    \centering 
    \begin{minipage}[b]{0.5\linewidth}
            \begin{verbatim}
       __  ____      _ __   ________
      /  |/  (_)__  (_) /  / __/ __/
     / /|_/ / / _ \/ / /___\ \_\ \
    /_/  /_/_/_//_/_/____/___/___/

        \end{verbatim}
            \captionof{figure}{logo1}
    \label{interpt1}
    \end{minipage}\hspace*{5mm}
    \begin{minipage}[b]{0.3\linewidth}
    \centering
        \begin{verbatim}
       __  ____      _ __   ________
      /  |/  (_)__  (_) /  / __/ __/
     / /|_/ / / _ \/ / /___\ \_\ \
    /_/  /_/_/_//_/_/____/___/___/

        \end{verbatim}
    \captionof{figure}{logo2}
    \label{interpt2}
    \end{minipage}
\end{figure}
\end{document}

photo

The minibox is simple to understand so i used it.

droid192
  • 594
  • The linked answers seem to provide a solution and you forgot to put \usepackage{caption}. –  Apr 29 '19 at 23:16
  • they entangle things, i do not have userdefined env. and no special symbols. its hard to see (so for other newbies) – droid192 Apr 29 '19 at 23:34

3 Answers3

5

verbatimbox can help.

\documentclass{article}
\usepackage{amsmath,verbatimbox}
\usepackage{lipsum, caption}  
\usepackage[showframe,pass]{geometry}
\begin{document}
\begin{figure}[ht]
    \centering \smallskip
\begin{verbbox}[\small]
   __  ____      _ __   ________
  /  |/  (_)__  (_) /  / __/ __/
 / /|_/ / / _ \/ / /___\ \_\ \
/_/  /_/_/_//_/_/____/___/___/
\end{verbbox}
    \begin{minipage}[b]{0.5\linewidth}
\theverbbox
\captionof{figure}{logo1}
\label{interpt1}
\end{minipage}\hspace*{5mm}
\begin{minipage}[b]{0.3\linewidth}
    \centering
\begin{verbbox}[\tiny]
   __  ____      _ __   ________
  /  |/  (_)__  (_) /  / __/ __/
 / /|_/ / / _ \/ / /___\ \_\ \
/_/  /_/_/_//_/_/____/___/___/
\end{verbbox}
\theverbbox
\captionof{figure}{logo2}
\label{interpt2}
\end{minipage}
\end{figure}
\begin{figure}[ht]
\centering
\begin{verbbox}[\LARGE]
   __  ____      _ __   ________
  /  |/  (_)__  (_) /  / __/ __/
 / /|_/ / / _ \/ / /___\ \_\ \
/_/  /_/_/_//_/_/____/___/___/
\end{verbbox}
\theverbbox
\caption{Here is my scaled verbatim}
\end{figure}
\end{document}

enter image description here

2

Using your second link I got these results enter image description here

\documentclass[9pt]{article}
\usepackage{amsmath,adjustbox,fancyvrb,caption}
\usepackage{lipsum}  


\newenvironment{myverb}{%
 \VerbatimEnvironment
 \begin{adjustbox}{max width=\linewidth}
 \begin{BVerbatim}
  }{
  \end{BVerbatim}
 \end{adjustbox}
}

\begin{document}

\begin{figure}[!h]\centering \Huge % \huge \LARGE \Large \large these are case sensitive simply move the % comment to the right for smaller
\begin{myverb}
       __  ____      _ __   ________
      /  |/  (_)__  (_) /  / __/ __/
     / /|_/ / / _ \/ / /___\ \_\ \
    /_/  /_/_/_//_/_/____/___/___/
\end{myverb}
  \captionof{figure}{Huge 1}
  \label{interpt2}
\end{figure}

  \vspace{0.5cm}

\begin{figure}[!h]\centering \small \footnotesize \scriptsize \tiny %these are case sensitive simply move the % comment to the left for larger
\begin{myverb}
       __  ____      _ __   ________
      /  |/  (_)__  (_) /  / __/ __/
     / /|_/ / / _ \/ / /___\ \_\ \
    /_/  /_/_/_//_/_/____/___/___/
\end{myverb}
  \captionof{figure}{Tiny 2}
  \label{interpt2}
\end{figure}

\end{document}
1

You can use BVerbatim from fancyvrb.

Don't indent verbatim environments as spaces at the beginning of the line are honored.

\documentclass{article}
\usepackage{amsmath}
\usepackage{fancyvrb}
\usepackage{lipsum, caption}  

\begin{document}

\lipsum[1-2] % just to force bottom figures

\begin{figure}[!b]
\centering
\begin{BVerbatim}[fontsize=\scriptsize]
   __  ____      _ __   ________
  /  |/  (_)__  (_) /  / __/ __/
 / /|_/ / / _ \/ / /___\ \_\ \
/_/  /_/_/_//_/_/____/___/___/
\end{BVerbatim}
\caption{logo1}\label{interpt1}
\end{figure}

\begin{figure}[!b]
\centering
\begin{BVerbatim}[fontsize=\fontsize{5}{6}\selectfont]
   __  ____      _ __   ________
  /  |/  (_)__  (_) /  / __/ __/
 / /|_/ / / _ \/ / /___\ \_\ \
/_/  /_/_/_//_/_/____/___/___/
\end{BVerbatim}
\caption{logo2}\label{interpt2}
\end{figure}

\end{document}

enter image description here

egreg
  • 1,121,712