2

This is honestly a part of my project that I have been dreading. I am wondering how to improve the appearance of my SAS output in my latex document because right now . . . it's not amazing. Any suggestions are appreciated!

Here's a snippet of my code:

\documentclass[twocolumn]{article}
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{caption}
\usepackage{textcomp}
\usepackage{graphicx}

\begin{document}
\includegraphics[width=8cm,height=7cm]{bubble.png}
\end{document}

Have a look:

enter image description here

Edit: 4/28

@NicolaTalbot made the line width statement evident to me:

\documentclass[twocolumn]{article}


\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{caption}
\usepackage{textcomp}
\usepackage{graphicx}

\usepackage{geometry}
\usepackage{rotating}
\usepackage{booktabs, makecell}
\usepackage[referable]{threeparttablex}
\usepackage{siunitx}
\usepackage[skip=1ex]{caption}

\title{\LARGE \bf ECON 425 Term Paper}

\begin{document}

\includegraphics[width=\linewidth]{bubble.png}

\end{document}

This is cool, but the image still doesn't appear centered within the column which is a bit disorienting. Does anyone know how to situate the figure more in the center?

This is what it currently looks like:

enter image description here

texmex
  • 349
  • The question is very broad un unclear to me at the moment. You did not even post some code. By the way, I do not find the result very ugly. I like the graph :). – Dr. Manuel Kuehner Apr 27 '18 at 17:57
  • @Dr.ManuelKuehner thanks! I didn't post any code, because there really wasn't much. But I will edit the post and add some code. And my question really is just for people who have tried this before who may have some tips or tricks about the best way to do this. For example, I can barely read the title--maybe it would be better to type up the title rather than have it in the SAS output? Not sure. – texmex Apr 27 '18 at 18:00
  • You can control the title-size with font-size commands (\large , Large, & so on), if I understand what you say...; If you are importing an image, just get rid of the title and add it using latex. –  Apr 27 '18 at 18:03
  • @santimirandarp but the title is in the .png image--so that probably can't be adjusted – texmex Apr 27 '18 at 18:06
  • 1
    Related: https://tex.stackexchange.com/questions/128185/how-to-give-floats-figures-titles –  Apr 27 '18 at 18:16
  • I suggest that you include a list in the question. The list could state some kind of "degree of freedom" (what can be changed). – Dr. Manuel Kuehner Apr 27 '18 at 18:23
  • 1
    there is no usable code in the code fragment you posted (end document but no begin document for example but looking at your image it looks like your graphic is too wide for the column and also son't do \includegraphics[width=8cm,height=7cm]{bubble.png} just specify one of width or height otherwise you will distort the image – David Carlisle Apr 27 '18 at 20:22
  • @DavidCarlisle I added the begin document. And thanks for the advice--ill change that now. – texmex Apr 27 '18 at 20:50
  • It's probably simpler to set the width relative to the current line width. For example \includegraphics[width=\linewidth]{bubble.png} or \includegraphics[width=0.9\linewidth]{bubble.png} – Nicola Talbot Apr 27 '18 at 22:57
  • @NicolaTalbot thanks for that code. I prefer that over guessing. I will edit the original post for a follow-up question – texmex Apr 28 '18 at 17:22
  • In your second MWE the initial paragraph indent is shifting the figure over to the right slightly. If it's inside a figure environment it should be sufficient to do something like \begin{figure}\centering\includegraphics[...]{...}\caption{}...\end{figure}. Outside of a figure environment you need something like {\centering\includegraphics[...]{...}\par} (the \par before the closing brace is important). Or just \noindent\includegraphics[...]{...} – Nicola Talbot Apr 28 '18 at 23:32

1 Answers1

1

To summarise the comments:

Use \linewidth or fractions of \linewidth to adjust the width. It's easier than trying to guess the correct length. Examples:

\includegraphics[width=\linewidth]{example-image}

\includegraphics[width=0.75\linewidth]{example-image}

In the default justified text, you need to take the paragraph indentation into account. This can be suppressed with \noindent at the start of the paragraph. Alternatively, if you use \centering, \flushleft or \flushright, the paragraph indent is change to 0pt. For example:

{\centering
 \includegraphics[width=\linewidth]{example-image}
 \par
}

The \par is important and needs to go before the scope ends. The figure environment automatically scopes the contents so the braces aren't needed there.

In the example below, the first image is the scaled to the width of the line, but the paragraph indent causes it to shift over the edge of the column.

\documentclass[twocolumn]{article}

\usepackage{geometry}
\usepackage{graphicx}
\usepackage{lipsum}% dummy text

\begin{document}
\lipsum[1-2]%dummy text

\includegraphics[width=\linewidth]{example-image-a}

\lipsum[11]%dummy text

\noindent\includegraphics[width=\linewidth]{example-image-b}

\lipsum[13]%dummy text

\begin{figure}
 \centering
 \includegraphics[width=\linewidth]{example-image-c}
 \caption{An Example}
\end{figure}
\end{document}

image of document

Nicola Talbot
  • 41,153