Docsity

Using LaTeX document class sugconf to write your paper, Study notes of Microsoft Word Skills

Toggle sidebar
bg1
Paper 008-2021
Using LaTeX document class sugconf to write your paper
Ronald J. Fehd, Stakana Analytics
SAS®software international conference, SAS Global Forum (SGF), nowAbstract Description:
accepts papers written with the L
A
T
E
X document preparation system which
produces a .pdf.
This paper illustrates use of the LaTeX document class sugconf, showsPurpose:
a basic paper template and provides references to basic and advanced
usage of LaTeX.
SAS user group authors, particularly those using Jupyter NotebookAudience:
document preparation, markup language, ods latex, typesetting, text (.tex)Keywords:
to .pdf
In this paper Introduction 2
The basics 3
What LaTeX provides 5
Advanced usage 9
Other classes and packages 11
Recommended reading 12
References 12
Appendix: example document listings 13
List of Figures 1 comparison of maketitle in classes article and sugconf . . . . 4
2 description of figure . . . . . . . . . . . . . . . . . . . . . . . 6
3 environments for lists: description, enumerate, itemize . . . . 7
4 environment thebibliography . . . . . . . . . . . . . . . . . . . 8
5 environment tabular, enhancements . . . . . . . . . . . . . . 9
6 environments figure and table, placement=Here . . . . . . . . 10
7 example figure: graphic of something . . . . . . . . . . . . . . 10
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Using LaTeX document class sugconf to write your paper and more Study notes Microsoft Word Skills in PDF only on Docsity!

Paper 008-

Using LaTeX document class sugconf to write your paper

Ronald J. Fehd, Stakana Analytics

Abstract Description: SAS®^ software international conference, SAS Global Forum (SGF), now

accepts papers written with the LATEX document preparation system which produces a .pdf. Purpose: This paper illustrates use of the LaTeX document class sugconf, shows a basic paper template and provides references to basic and advanced usage of LaTeX. Audience: SAS user group authors, particularly those using Jupyter Notebook Keywords: document preparation, markup language, ods latex, typesetting, text (.tex) to .pdf

In this paper Introduction 2

The basics 3

What LaTeX provides 5

Advanced usage 9

Other classes and packages 11

Recommended reading 12

References 12

Appendix: example document listings 13

List of Figures^1 comparison of maketitle in classes article and sugconf....^4

2 description of figure....................... 6 3 environments for lists: description, enumerate, itemize.... 7 4 environment thebibliography................... 8 5 environment tabular, enhancements.............. 9 6 environments figure and table, placement=Here........ 10 7 example figure: graphic of something.............. 10

Introduction

Overview Donald Knuth (1978) developed the TEX typesetting software in order to typeset complex mathematical formulas. Leslie Lamport (1984) wrote a set of macros known as LATEX which provided the basic markup for document production. TEX and LATEX are markup languages. A document consists of two parts: content: what the reader sees, and structure: what the markup language uses for organizing the pages in and of the document. Markup is concerned with standardizing the structure.

SAS In SAS macro language there are two kinds of macro usage: macro variables and macro definitions. Macro variables are allocated or (re-)assigned with the statement: %let %let mvar = value; References to macro variables are preceeded by ampersand: &mvar %put &mvar; Macro definitions are allocated with the pair of statements: %macro %macro xyz(parm(s)); ... %mend; References to macro definitions are preceeded by percent sign: %xyz %xyz(parm(s))

LaTeX TeX and LaTeX call their macros command strings. Backslash is the special character used in allocation and reference. Command strings are allocated with the statement: \new: \newcommand\xyz{text.0} To reassign a command, use \renew: \renewcommand\xyz{text.1} References to command strings are preceeded by a backslash: \xyz width=\textwidth Command strings may be assigned with parameters: \fx[n] \newcommand\fx[2]{text #1, text #2} References to command strings with parameters are written with the parameters enclosed in curly brackets: \fx{z} \section{Abstract} References to command strings with optional parameters are written with the options enclosed in square brackets: \fx[y]{z} \includegraphics[width=0.5\textwidth]{banner-sgf-2021.png}

command strings Class sugconf provides these command strings for use in \maketitle. for maketitle \sugconfbanner{filename.ext} filename.ext is a graphics file, e.g.: .jpg, .png \sugconfpapernumber{text} text is ”Paper 999-<conf-year>”

preamble

Class sugconf provides three macro variables for use in the .tex document: \SASregistered SAS® \SASisRegisteredTrademark SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registra- tion. \OtherTrademarks Other brand and product names are trade- marks of their respective companies.

usage, in .tex

comparison Figure 1 provides a comparison of the markup and results of classes article and sugconf.

Figure 1 comparison of maketitle in classes article and sugconf %name: hello-world-article.tex \documentclass{article} \title{Linear Models} \author{Jim Goodnight} \date{January 26, 1976} \begin{document} \maketitle "Hello World" \end{document}

Linear Models

Jim Goodnight

January 26, 1976

”Hello World”

maketitle: article

%name: hello-world-sugconf.tex \documentclass{sugconf} \sugconfbanner{banner-sgf-2021.png}% \sugconfpapernumber{Paper Sugi-76-03}% \title{SAS Matrix} \author{John Sall} \begin{document} \maketitle Hello \SASregistered users

% remember this boilerplate % at end of document: \SASisRegisteredTrademark %if applicable: \OtherTrademarks \end{document}

SAS®^ Global Forum 2021

Paper Sugi-76-

SAS Matrix

John Sall

Hello SAS®^ users

SAS and all other SAS Institute Inc. product or service names are regis- tered trademarks...

maketitle: sugconf

What LaTeX provides

This is the overview, which consists of a list of topics in this section.

  • markup commands
  • multiple authors
  • superscripts: SAS®^ Foobar™
  • graphics width
  • cross references: label, pageref, ref
  • environments figure, table
  • lists: description, enumerate, itemize
  • minipage
  • references: thebibliography
  • text font: texttt, verbatim

markup commands :^ special characters of SAS are also special characters in LaTeX &, %, : &mvar, %put, under\ line; fill : horizontal: \hfill, vertical: \vfill font specs : sizes : \small, \footnotesize, \scriptsize, \tiny styles : \textit{italic}, \textsc{SMALL CAPS}, \textsl{slant}, \texttt{text, monospace}, Jupyter : \input{my-Jupyter-notebook}%.tex

markup commands, continued

justify : inside an environment: {\centering... } \begin{center }... \end{center } new line : \newline in lists, \ in \author, \title, tabular environment page break : \newpage space : horizontal : \hspace{width}: \hspace{3em}, \quad, \qquad vertical : \vspace{width}: \vspace{ 2 \baselineskip}, \smallskip, \medskip, \bigskip; see also \vfill width : \textwidth

multiple authors \author{name1 \ name2 \... nameN } The \author command may have have several authors on separate lines by using double backslash between each name. This markup for a newline may be used in \title as well. The environment tabular also uses double backslash for a new line.

superscripts: \textsuperscript{\scriptsize\textregistered}
SAS® foobar™

To place the ® symbol after mention of other software use the \textsuperscript command. The fontsize is \scriptsize. The backslash ( \ ) after the close curly bracket is necessary to provide a space after \textregistered or \texttrademark.

graphics width \includegraphics[width=0.5\textwidth]{banner-conf-year.png} The \includegraphics command has a required parameter of {filename.ext}. Its optional parameters are enclosed in square brackets. Use the [width=\textwidth] to ensure the graphic fits inside the page. note: The graphicx package provides command \includegraphics; it is loaded by class sugconf.

Table 1 this table is a float example tabular which has been 'floated' to top of page

note: The minipage environment, shown below, also provides an unbreakable box.

lists \begin{list} \item... \item... \end{list}

Three environments are provided for lists: description, enumerate, and itemize.

Figure 3 environments for lists: description, enumerate, itemize description : \begin{description} \item[this is] a labeled list \item[descriptors] must be enclosed in square brackets \end{description}

this is : a labeled list descriptors : must be enclosed in square brackets

enumerate : \begin{enumerate} \item numbered list \item the second line \end{enumerate}

  1. numbered list
  2. the second line

itemize : \begin{itemize} \item bulleted list \item the 2nd item \end{itemize}

  • bulleted list
  • the 2nd item

minipage \begin{minipage}{width}... \end{minipage} The minipage environment provides an unbreakable box. All of the side- by-side examples in this paper are constructed with this method.

\begin{minipage}{0.45\textwidth} left \end{minipage} \hfill %horizontal fill with blanks \begin{minipage}{0.45\textwidth} right \end{minipage}

references \begin{thebibliography} \bibitem{key} \end{thebibliography}

The basic environment for references is thebibliography. Within the environment are one or more \bibitem{cite-key} items. Use the markup \cite{cite-key-n} to refer to the bibitems.

Figure 4 environment thebibliography usage, in .tex \begin{thebibliography}{9}^ %9=n(bibitem); 99 for more than 10

\bibitem{example.plain} %\cite{example.plain}: [1]

\bibitem[ex.lbl]{example.label} %\cite{example.label}: [ex.lbl]

\bibitem[label]{cite-key} Author, (year), "title". In: \textit{conference}. \textsc{url:} \url{...}.

\end{thebibliography} See the typeset results for this paper in section 2, References, on page 12.

text font \texttt{text}, \begin{verbatim}... \end{verbatim}

Two markups are available to typeset text in typewriter (monospace) font: \texttt{text} and the environment verbatim.

! → Remember that SAS special characters of the macro language, ampersand

and percent, must be preceeded by backslash when used in \texttt. \texttt{%put echo: &=mvar;} %put echo: &=mvar;

\begin{verbatim} %let mvar = value; %put echo: &=mvar; \end{verbatim}

%let mvar = value; %put echo: &=mvar;

See also the fancyvrb packages on page 10 which provides the Verbatim environment with options to control the font size of the text.

caption The caption packages provides an alternative to the figure and table environments which float; i.e. the box of the illustration may be moved to top or bottom, or even a new page. If you want your figure or table exactly Here then use this. preamble (^) \usepackage%{caption}%\captionof{figure|table}{...\label{...}} [font=bf% ,justification=raggedright% ,labelsep=quad%colon newline period quad=1em qquad=2em space ,singlelinecheck=false] {caption}%

Figure 6 environments figure and table, placement=Here usage, in .tex (^) Figure \ref{sec:fig:xyz}, \nameref{sec:fig:xyz} illustrates

\captionof{figure}{example figure: graphic of something%description \label{sec:fig:xyz}}%note two close curly brackets %the label is inside the captionof description

Table \ref{sec:tbl:xyz}, \nameref{sec:tbl:xyz} shows

\captionof{table}{example table: lookup table as format% \label{sec:tbl:xyz}}%

usage, in .pdf Figure 7, example figure: graphic of something illustrates Figure 7 example figure: graphic of something

Table 2, example table: lookup table as format shows

Table 2 example table: lookup table as format

fancy verbatim The markup examples have been shown using the fancyvrb package en- vironment Verbatim, which provides an option to change the fontsize. Font sizes are: \small, \footnotesize, \scriptsize, and \tiny. preamble \usepackage{fancyvrb}%FancyVrb setup: \fvset{frame=bottomline}%topline bottomline lines single usage, in .tex \begin{Verbatim}[fontsize=\small] PROC freq data = sashelp.class; tables sex / list missing noprint out = work.freq_class_sex; run; \end{Verbatim} usage, in .pdf PROC freq data = sashelp.class; tables sex / list missing noprint out = work.freq_class_sex; run;

note: To echo programs use \VerbatimInput{filename.sas}. For multi-page programs use options firstline and lastline. \newcommand\FileNameExt{proc-freq.sas} \VerbatimInput[lastline=40]{\FileNameExt} \newpage \VerbatimInput[firstline=41,lastline=80]{\FileNameExt}

hyperref Package hyperref provides \href and \url. href has two arguments: \href{url}text url has one argument: \url{url} preamble None; hyperref is loaded by class sugconf. usage, in .tex \href{https://ctan.org/}{Comprehensive TeX Archive Network} Comprehensive TeX Archive Network \url{https://ctan.org/} https://ctan.org/

nameref The nameref package provides a method to obtain the text of the caption of a figure or table. preamble \usepackage{nameref} usage, in .tex (^) reference to figure \ref{sec:fig:xyz}, \nameref{sec:fig:xyz}, on page \pageref{sec:fig:xyz}

usage, in .pdf reference to figure 7, example figure: graphic of something, on page 10.

statrep The statrep package provides two environments and two tags that work together to display your SAS code and results and to generate the SAS program that produces those results. The two environments (Datastep and Sascode) display SAS code. The two tags (Listing and Graphic) display SAS output. These environments are output from ODS latex destination. See [statrep.cls] and [ODS latex] for usage. preamble \usepackage{statrep} usage, in .tex \input{my-statrep-output}%.tex

Other classes and packages

beamer The beamer class changes page specifications to landscape to fit one page to screen size, similar to .ppt. The .tex document (my-doc-as-main.tex) can also be processed to pro- vide an article: my-doc-as-article.pdf. See the appendix, page 13, for examples.

pdfpages The pdfpages package provides a method to copy pages from another .pdf (my-doc-as-ppt.pdf) into the document. This is useful for creating a 4-up handout of a beamer presention: my-doc-as-ppt-4up-handout.pdf. See the appendix, page 13, for examples.

refart The reference manual class provides a wide left margin for section titles. The layout is based on Robert E. Horn’s Information Mapping®^ discipline as outlined in his book Mapping Hypertext. This document was marked up using the refart class.

Conclusion SAS macro language is similar to LaTeX markup; each has a set of special

characters which are used to access functions. LaTeX has functions which can typeset the special characters of SAS macro language, ampersand and percent.

Appendix: example document listings

Beamer suite main %name: my-doc-as-main.tex %\usepackage{fancyvrb}%\VerbatimInput{proc-freq.sas} \begin{document} text \end{document} article=sugconf %name: my-doc-as-sugconf.tex \documentclass{sugconf} \usepackage[notheorems]{beamerarticle} \input{my-doc-as-main}%.tex \endinput ppt %name: my-doc-as-ppt.tex \documentclass{beamer} %% Setup appearance: usetheme \usetheme{Berlin}%banner:top \usefonttheme{default} \input{my-doc-as-main}%.tex \endinput ppt 4-up handout %name: my-doc-as-ppt-4up-handout.tex \documentclass{article} \usepackage{pdfpages} \begin{document} \includepdf[landscape,nup=2x2,pages=-] {my-doc-as-ppt}%.pdf \end{document}

SAS-user-group-paper-LaTeX-class-sugconf.tex

%name: SAS-user-group-paper-LaTeX-class-sugconf.tex \documentclass{sugconf} \sugconfbanner{banner-sgf-2021}%.png \sugconfpapernumber{Paper 999-2021} \title{SAS User Group Sample Paper using LaTeX class sugconf} \author{Author 1 name, ABC Corporation %; %\ %newline %Author 2 name, DEF Corporation; %\ %newline %Author 3 name, GHJ University }%end author %to use packages remove % in column. %\usepackage{booktabs}%\toprule \midrule \bottomrule %\usepackage{caption}%\captionof{figure|table}{description\label{x:y:z}} %\usepackage{fancyvrb}%\VerbatimInput[options]{filename.sas} %\usepackage{nameref}%\nameref{x:y:z} %\usepackage{statrep}%\input{my-ods-latex-output}%.tex \begin{document}\maketitle \section{ABSTRACT}%(heading 1) This paragraph includes the first reference to \SASregistered software \tableofcontents\hrulefill%use for rough draft, disable for final \section{INTRODUCTION}%(heading 1) This paragraph expands on the abstract. \section{FIRST MAIN TOPIC}%(heading 1) \subsection{SUBHEAD A}% (heading 2) \subsubsection{Subsubhead A.1}% (heading 3)

Example citations: \cite{example.plain} \cite{example.label} \cite{cite-article}

\newpage % \section{Environments}

\subsection{Figures, or tables}

\begin{figure}[h] \begin{center} graphic here: %\includegraphics %[height=12\baselineskip, % width=0.25\textwidth % ]% %{article-hello-world.pdf} \caption{about this graphic} \label{fig.1}%optional \end{center} \end{figure}

\begin{table}[h] \centering \caption{lookup table for ...} \label{tbl.1}%optional text here: \begin{tabular}{lcr}\hline left & center & right \ %newline \hline \end{tabular} \end{table}

\subsection{Lists}

This is a labeled list:

\begin{description} \item[x] description of x \item[y] need to know about y \end{description}

Here is the numbered list:

\begin{enumerate} \item a \item b \end{enumerate}

And last, bulleted:

\begin{itemize} \item 1 \item 2 \end{itemize}

\subsection{Program listing} If you need to include source code, introduce it with a sentence that ends with a colon:

\begin{verbatim} %let mvar = value; %put echo: &=mvar; \end{verbatim}

use fontsize=small for log {\small \begin{verbatim} echo: &=mvar; \end{verbatim} }%end log

use fontsize=(footnotesize | scriptsize | tiny) for listing {%\footnotesize