# Latex space reducing hacks

1. Reduce space above and below equations: Place following lines after \begin{document}
\setlength{\abovedisplayskip}{2pt}
\setlength{\belowdisplayskip}{2pt}

2.  Reduce space above and below section/subsection titles. Place these lines before beginning the document.

\usepackage[compact]{titlesec} \titlespacing*{\section} {0pt}{2\baselineskip}{3\baselineskip} \titlespacing*{\subsection} {0pt}{2\baselineskip}{3\baselineskip} 

This answer is copied from this StackOverflow link. In Springer, llncs format I found this sucks but a hack around the same is provided in this StackOverflow answer. It really works!!.

# Side by side latex figure/table placement

1.  Place two figures side by side with separate captions and labels [copied from https://tex.stackexchange.com/a/37582/88745%5D

\usepackage{subfigure}
\begin{figure}
\centering
\parbox{5cm}{
\includegraphics[width=5cm]{img1}
\caption{First.}
\label{fig:2figsA}}
\begin{minipage}{5cm}
\includegraphics[width=5cm]{img2}
\caption{Second.}
\label{fig:2figsB}
\end{minipage}
\end{figure}


2. Place Table and a Figure side by side.   [source:https://tex.stackexchange.com/a/265891/88745%5D

\documentclass{article}
\usepackage{graphicx}
\usepackage{capt-of}% or \usepackage{caption}
\usepackage{booktabs}
\usepackage{varwidth}

\begin{document}
\begin{table}[ht]
\begin{varwidth}[b]{0.6\linewidth}
\centering
\begin{tabular}{ l r r r }
\toprule
Student & Hours/week & Grade \\
\midrule
Ada Lovelace & 2 & A \\
Linus Thorvalds & 8 & A \\
Bruce Willis & 12 & F \\
Richard Stallman & 10 & B \\
Grace Hopper & 12 & A \\
Alan Turing & 8 & C \\
Bill Gates & 6 & D \\
Steve Jobs & 4 & E \\
\bottomrule
\end{tabular}
\caption{Student Database}
\label{table:student}
\end{varwidth}%
\hfill
\begin{minipage}[b]{0.4\linewidth}
\centering
\includegraphics[width=40mm]{example-image}
\captionof{figure}{2-D scatterplot of the Student Database}
\label{fig:image}
\end{minipage}
\end{table}
\end{document}

# Insert Latex equations and tables in Powerpoint and Keynote

At times we need to copy the Latex equations and tables in our presentation slides prepared either in Microsoft Powerpoint or Apple Keynote. There are many options to do the same but here I will explain a simple approach

2. Open LatexiT and copy the required latex equation/table from your latex file into the LatexiT editor. Make sure that you remove- begin{table}, begin{equation} type of commands.   After copying, click on LaTeX it button at bottom right to generate equations and tables
3. Once your equation/table is drawn, save the file using from File Menu.

There are different options for customizing the output such as font size, installing new packages.

# LaTeX for Complex Stuff

In this post, I will keep updating solutions to common problems we face while preparing LaTeX manuscripts.

Customise the width of any cell in a table: First include package pbox. Then, cell contents of a table will go like this \pbox{5cm}{blah blabh}. Even the contents of cell can be forced to next line by using double backslash, i.e., \\

Customise width of entire table column: In this case, instead of mentioning l,c,r options of tabular environment for the said column, use p with width . For example \begin{tabular}{|r|c|p{4cm}} [Reference]

Present table in landscape style  [Ref]: Add necessary packages and the syntax to show table in landscape mode is as

\usepackage{floats,lscape}
\begin{landscape}
\begin{table}
…table stuff…
\end{table}
\end{landscape}

Place text and Figure side by side: This question mentions how space around the image can be managed

\usepackage{wrapfig}
\begin{wrapfigure}{r}{4cm} //first option is placement (l,r), second width
\includegraphics[]{abc.pdf}
\caption{}
\label{}
\end{wrap figure}

Show complete paper reference (title, author name, etc) without citation:

\usepackage{bibentry}
\nobibliography*

Write above two lines in the document heading in the same order, and then in the main document, for citing purpose write  \bibentry{paperkey}

Shrink a table if it moves outside the text area:

Use resizebox as explained in this Stackoverflow answer.