Text FormattingDocument Design Feedback

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Dreyer
Posts: 2
Joined: Tue Nov 15, 2011 3:03 pm

Document Design Feedback

Post by Dreyer »

In the following weeks I am going to need to make several documents like this one https://drive.google.com/file/d/0B3FvzC ... JwX2c/view.

Which are going to be handouts given to students covering the main topics of the lesson.

At the moment I am dividing the document using either parbox (for single lines) or minipage (for multiple lines) combined with the tabular environment for better alignment. I am also using parkskip to define the vertical space between each box:

Code: Select all


\documentclass[10pt,a4paper,landscape]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[left=1cm,right=1cm,top=1cm,bottom=0.4cm]{geometry}
\usepackage{inconsolata}
\usepackage[parfill]{parskip}
\usepackage[cmyk]{xcolor}
\usepackage[usestackEOL]{stackengine}

\definecolor{red}{RGB}{153,0,0}
\definecolor{blue}{RGB}{51,102,153}
\pagestyle{empty}
\setlength{\parskip}{3mm}

\begin{document}

\parbox[t]{200mm}{\huge{\textbf{Resumo Aula 1 - Curso MATLAB}}}

\parbox[t]{200mm}{\huge{$\bullet$ Concatenação e criação de matrizes - Operador \texttt{[]} e \texttt{:}}}

%\fbox
{
    \begin{minipage}[t]{140mm}
    \Large
    \renewcommand{\arraystretch}{1.5} 
    \begin{tabular}{ l l l }
        \texttt{a = [1,2,3,4]} & \texttt{a = [1 2 3 4]} & Vetor Coluna \\
        \texttt{a = [1,2,3,4]} &  & Vetor Linha  \\
        \texttt{c = [a,a]} & \texttt{c = [a a]} & Concatenização Vertical \\
        \texttt{C = [a;a]} & & Concatenização Horizontal
    \end{tabular}
    \end{minipage}
}
%\fbox
{
    \begin{minipage}[c]{100mm}
    \Large
    \renewcommand{\arraystretch}{1} 
    \begin{tabular}{ l l }
        \texttt{zeros} & Matriz de zeros \\
        \texttt{ones} & Matriz de números 1 \\
        \texttt{eye} & Matriz identidade  \\
        \texttt{rand} & Matriz de números aleatórios \\
        \texttt{zeros(3,3)} &  Matriz 3x3\\
        \texttt{zeros(1,3)} &  Matriz 3x1
    \end{tabular}
    \end{minipage}
}

\parbox[b]{65mm}{\Large{\texttt{inicio:incremento:fim}}}
\parbox[b]{60mm}{\Large{\texttt{1:2:10}}$\rightarrow$ \texttt{[1 3 5 7 9]}}
\parbox[b]{40mm}{\Large{\texttt{1:4}}$\rightarrow$ \texttt{[1 2 3 4]}}
\parbox[c]{40mm}{Se o incremento não for especificado é considerado um incremento de 1}

\parbox[t]{200mm}{\huge{$\bullet$ Indexação - Operadores \texttt{()} e \texttt{:}}}

%\fbox
{
    \begin{minipage}[t]{200mm}
    \Large
     \renewcommand{\arraystretch}{1.5} 
    \begin{tabular}{ l l }
        \texttt{A(indice)} & Procura através das colunas \\
        \texttt{A(indiceLinha, indiceColuna)} & Intersecção do vetor \texttt{indiceLinha} e \texttt{indiceColuna}  \\
        \texttt{end} & Seleciona o último elemento de uma dimensão \\
        \texttt{:} & Seleciona toda uma dimensão
    \end{tabular}
    \end{minipage}
}

%\fbox
{
    \begin{minipage}[c]{130mm}
        \Large
        \includegraphics{exemploIndexacao}
        
        \texttt{\textcolor{red}{indiceLinha} = [1 3]}
        
        \texttt{\textcolor{blue}{indiceColuna} = [2 3]}
        
        \texttt{A(\textcolor{red}{indiceLinha}, \textcolor{blue}{indiceColuna})}
        
    \end{minipage}
}
%\fbox
{
    \begin{minipage}[c]{135mm}
         \Large
        \renewcommand{\arraystretch}{1.5} 
        
        \begin{tabular}{ l l }
            \texttt{A(:,2)} & Segunda coluna completa  \\
            \texttt{A(:)} & Todos os elementos de A em um vetor coluna   \\
            \texttt{A([1 3],:)} & Primeira e terceira linha completa \\
            \texttt{A(1,end)} & Primeira e última coluna
        \end{tabular}
        \end{minipage}
}

\scriptsize\raggedleft\vfill{\textbf{Copyright \copyright\ 2016 Pedro Dreyer (pedrodreyer@hotmail.com)}}




\end{document}
What do you guys think? Is there a more correct/elegant way to archive the same result?

some other questions:

1- Can I make the parbox width be exactly the size of the text inside it?

2-Why I am receiving an overfull \hbox warning? The width of the minipages are more than enough to fit its contents.

3- Any input/comment on the overall design of the document?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Document Design Feedback

Post by Johannes_B »

There is no need for all those parboxes. Also, i would use package listings for the source code.

Code: Select all

\documentclass[%10pt,%Settin a larger base font later
a4paper,landscape]{article}
\usepackage[14pt]{extsizes}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[left=1cm,right=1cm,top=1cm,bottom=0.8cm]{geometry}
\usepackage{inconsolata}
\usepackage[cmyk]{xcolor}
\usepackage[usestackEOL]{stackengine}

\definecolor{red}{RGB}{153,0,0}
\definecolor{blue}{RGB}{51,102,153}
\pagestyle{empty}

\usepackage{listings}
\lstset{
	basicstyle=\ttfamily,
	keywordstyle=\color{blue},
	language=Matlab,
morekeywords={indiceColuna,indiceLinha}
}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex}

\begin{document}

{\Large\textbf{Resumo Aula 1 - Curso MATLAB}

$\bullet$ Concatenação e criação de matrizes - Operador \lstinline![]! e \lstinline!:!}

    %\fbox
{
	\begin{minipage}[t]{140mm}
		
		\renewcommand{\arraystretch}{1.5}
		\begin{tabular}{ l l l }
			\lstinline!a = [1,2,3,4]! & \lstinline!= [1 2 3 4]! & Vetor Coluna \\
			\lstinline!a = [1,2,3,4]! &                          & Vetor Linha  \\
			\lstinline!c = [a,a]!     & \lstinline! = [a a]!     & Concatenização Vertical \\
			\lstinline!C = [a;a]!     &                          & Concatenização Horizontal
		\end{tabular}
	\end{minipage}
}
    %\fbox
{
	\begin{minipage}[c]{100mm}
		
		\renewcommand{\arraystretch}{1}
		\begin{tabular}{ l l }
			\lstinline!zeros! & Matriz de zeros \\
			\lstinline!ones! & Matriz de números 1 \\
			\lstinline!eye! & Matriz identidade  \\
			\lstinline!rand! & Matriz de números aleatórios \\
			\lstinline!zeros(3,3)! &  Matriz 3x3\\
			\lstinline!zeros(1,3)! &  Matriz 3x1
		\end{tabular}
	\end{minipage}
}

\lstinline!inicio:incremento:fim!\par
\lstinline!1:2:10!$\rightarrow$ \lstinline![1 3 5 7 9]!\par
\lstinline!1:4!$\rightarrow$ \lstinline![1 2 3 4]!\par
Se o incremento não for especificado é considerado um incremento de 1\par

{\Large$\bullet$ Indexação - Operadores \lstinline!()! e \lstinline!:!}

    %\fbox
{
	\begin{minipage}[t]{200mm}
		
		\renewcommand{\arraystretch}{1.5}
		\begin{tabular}{ l l }
			\lstinline!A(indice)! & Procura através das colunas \\
			\lstinline!A(indiceLinha, indiceColuna)! & Intersecção do vetor \lstinline!indiceLinha! e \lstinline!indiceColuna!  \\
			\lstinline!end! & Seleciona o último elemento de uma dimensão \\
			\lstinline!:! & Seleciona toda uma dimensão
		\end{tabular}
	\end{minipage}
}

    %\fbox
{
	\begin{minipage}[c]{130mm}
		
		\includegraphics[width=.3\linewidth]{example-image}

		\lstinline!indiceLinha = [1 3]!

		\lstinline!indiceColuna = [2 3]!

		\lstinline!A(indiceLinha, indiceColuna)!

	\end{minipage}
}
    %\fbox
{
	\begin{minipage}[c]{135mm}
		
		\renewcommand{\arraystretch}{1.5}

		\begin{tabular}{ l l }
			\lstinline!A(:,2)!     & Segunda coluna completa  \\
			\lstinline!A(:)!       & Todos os elementos de A em um vetor coluna   \\
			\lstinline!A([1 3],:)! & Primeira e terceira linha completa \\
			\lstinline!A(1,end)!   & Primeira e última coluna
		\end{tabular}
	\end{minipage}
}

\scriptsize\raggedleft\vfill{\textbf{Copyright \copyright\ 2016 Pedro Dreyer (pedrodreyer@hotmail.com)}}

\end{document}
I made other small chnges (improvements) as well.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply