4

como estan? estoy haciendo un trabajo para la facultad y me esta pasando esto, es decir que se "justifican" las culumnas de mi archivo y no se como sacarlo. no se como controlar tampoco los espacios entre las tablas.

Editado

en primer lugar me disculpo por no explayarme mas antes. los espacios que me genera son los que estan con azul, los que me molestan mucho. pero si es posible me gustatia saber ademas como se puede manejar el espacio que hay entre una seccion y otra. Este es mi codigo

------------- Google translate -------------

Hello how are you? I am doing a job for the faculty and this is happening to me, that is to say that the columns in my file are "justified" and I don't know how to get it out. I don't know how to control the spaces between the tables either.

Edited

First of all I apologize for not elaborating further before. the spaces it generates for me are the ones with blue, the ones that bother me a lot. but if possible I would also like to know how to manage the space between one section and another. This is my code

\documentclass[a4paper,12pt,spanish]{article}
%PAQUETES
\usepackage[utf8]{inputenc} % puede ser redundante si tu flujo de trabajo es en utf-8 y usas TeXlive 2018 o más reciente.
\usepackage[T1]{fontenc} 
\usepackage[spanish]{babel}
\usepackage[left=1.5cm,top=1cm,right=1.5cm,bottom=1.5cm]{geometry} 
\usepackage[osf]{newtxtext}
\usepackage{textcomp} 
\usepackage{amsmath}
\usepackage{amssymb} 
\usepackage{amsthm} 
\usepackage{mathtools} 
\usepackage{siunitx}
\usepackage{multicol}
\usepackage[table]{xcolor}
\usepackage{graphicx} 
\usepackage{enumerate}
\usepackage{booktabs}
\usepackage{float}
\usepackage{caption} 
\usepackage{subcaption} 
\usepackage[colorlinks=true,citecolor=verde1,linkcolor=black,urlcolor=verde1]{hyperref}
\captionsetup[subfigure]{labelformat=simple}
\renewcommand\thesubfigure{(\alph{subfigure})}
\definecolor{verde}{rgb}{0.55, 0.71, 0.0} %http://latexcolor.com/ para mas colorcitos
\definecolor{verde1}{rgb}{0.0, 0.5, 0.0}

\begin{document}    
\title{ Title}
\author{Alastor\\ UUC}
\date{\null}
\maketitle
\begin{multicols*}{2}
    [
    \section*{Resumen}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text .
    ]

    
\section{Introducción}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 
    
\section{Implementacion}

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 
\begin{equation*}
A(x)=-20\mathrm{exp}({-\frac{\left|x\right|}{5}})-\mathrm{exp}({\cos\left(2{\pi}x\right)})+20+\mathrm{exp}(1)
\end{equation*}

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 

\section{Resultados}

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 

\begin{table}[H]
    \rowcolors{2}{gray!25}{white}
   \begin{center}
    \resizebox{0.4\textwidth}{!}{
     \begin{tabular}{ccccc} 
      \toprule
       S & K & Long. del intervalo & Valuaciones \\ [0.5ex] 
        \midrule
        \num{1e-1}& 2& 1.2& 6\\
        \num{1e-2}& 2& 0.96& 9\\
        \num{1e-3}& 2& 0.768& 12\\
        \num{1e-4}& 2& 0.6144& 15\\
        \num{1e-5}& 2& 0.9830& 19\\
        \num{1e-6}& 2& 0.7864& 22\\
        \num{1e-7}& 2& 0.6291& 25\\
        \num{1e-8}& 2& 0.5033& 28\\
        \num{1e-9}& 2& 0.8053& 32\\
        \num{1e-10}& 2& 0.6442& 35\\
      \bottomrule
    \end{tabular} }
    \caption{Longitud del intervalo con respecto a $s$ en BM con $x=1/2$}
    \label{tab: s}
   \end{center}
\end{table}

\begin{table}[H]
    \rowcolors{2}{gray!25}{white}
   \begin{center}
    \resizebox{0.4\textwidth}{!}{
     \begin{tabular}{ccccc} 
      \toprule
       S & K & X & V \\ [0.5ex]
        \midrule
        \num{1e-2}& 2& 0.96& 9\\
        \num{1e-2}& 1.9& 0.7180& 9\\
        \num{1e-2}& 1.8& 0.5290& 9\\
        \num{1e-2}& 1.7& 0.6517& 10\\
        \num{1e-2}& 1.6& 0.4362& 10\\
        \num{1e-2}& 1.5& 0.4271& 11\\
        \num{1e-2}& 1.4& 0.3541& 12\\
        \num{1e-2}& 1.3& 0.3170& 14\\
        \num{1e-2}& 1.2& 0.1961& 16\\
        \num{1e-2}& 1.1& 0.1167& 22\\
      \bottomrule
    \end{tabular} } 
    \caption{Longitud del intervalo con respecto a $k$ en BM con $x=1/2$}
    \label{tab: k}
\end{center}
\end{table}

\subsection*{Fibonacci Search} %\emph{agrega esto}

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  


 \end{multicols*}
 \end{document}


I tried with the next comands but they did not work

\setlength\floatsep{1.75\baselineskip plus 3pt minus 2pt}
\setlength\textfloatsep{1.75\baselineskip plus 3pt minus 2pt}
\setlength\intextsep{1.75\baselineskip plus 3pt minus 2 pt}

the spaces in red are what I want to solve, but as a second thing I would like to know how you can edit the blue spaces

Thanks

3
  • Hi, it would be helpful if you told us what document style you are using (article, book, ...) and also if you are using any packages (e.g. multicols for the column layout). Please re-create your issue in a minimal-working environment (MWE) such that we can reproduce your problem. That makes it a lot easier for us to help you!
    – pikopiko
    Nov 1, 2020 at 1:47
  • Without further information we can only guess. I guess that the table with caption on the second column does not fit in the space left on the left column (blue marked) spaces. Nov 1, 2020 at 1:55
  • Any news? You receive three answers ... does any of them solve your problem?
    – Zarko
    Nov 2, 2020 at 16:24

3 Answers 3

3

@Zarko has the right answer in my opinion and should be accepted as it is the right way to go about typesetting documents.

However, if you for some reason must have your document in two columns the way you do, and if you for some reason must use [H] the way you do, there is a way to control the spaces you wish to narrow:

  1. Using the titlesec package one can control the spacing between the section title and the text using the titlespacing\section{} command
  2. One can use the belowcaptionskip length to control how much space there is after a figure.

MWE:

\documentclass[a4paper,12pt,spanish]{article}
%PAQUETES
\usepackage[utf8]{inputenc} % puede ser redundante si tu flujo de trabajo es en utf-8 y usas TeXlive 2018 o más reciente.
\usepackage[T1]{fontenc} 
\usepackage[spanish]{babel}
\usepackage[left=1.5cm,top=1cm,right=1.5cm,bottom=1.5cm]{geometry} 
\usepackage[osf]{newtxtext}
\usepackage{textcomp} 
\usepackage{amsmath}
\usepackage{amssymb} 
\usepackage{amsthm} 
\usepackage{mathtools} 
\usepackage{siunitx}
\usepackage{multicol}
\usepackage[table]{xcolor}
\usepackage{graphicx} 
\usepackage{enumerate}
\usepackage{booktabs}
\usepackage{float}
\usepackage{caption} 
\usepackage{subcaption} 
\usepackage[colorlinks=true,citecolor=verde1,linkcolor=black,urlcolor=verde1]{hyperref}
\captionsetup[subfigure]{labelformat=simple}
\renewcommand\thesubfigure{(\alph{subfigure})}
\definecolor{verde}{rgb}{0.55, 0.71, 0.0} %http://latexcolor.com/ para mas colorcitos
\definecolor{verde1}{rgb}{0.0, 0.5, 0.0}

\usepackage[compact]{titlesec}
\titlespacing\section{0pt}{1pt minus 1pt}{1pt minus 1pt}
\titlespacing\subsection{0pt}{1pt minus 1pt}{1pt minus 1pt}
\setlength{\belowcaptionskip}{-2pt}


\begin{document}    
\title{ Title}
\author{Alastor\\ UUC}
\date{\null}
\maketitle
\begin{multicols*}{2}
    [
    \section*{Resumen}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text .
    ]

    
\section{Introducción}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 
    
\section{Implementacion}

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 
\begin{equation*}
A(x)=-20\mathrm{exp}({-\frac{\left|x\right|}{5}})-\mathrm{exp}({\cos\left(2{\pi}x\right)})+20+\mathrm{exp}(1)
\end{equation*}

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 

\section{Resultados}

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 

\begin{table}[H]
    \rowcolors{2}{gray!25}{white}
    \centering
    \resizebox{0.4\textwidth}{!}{
     \begin{tabular}{ccccc} 
      \toprule
       S & K & Long. del intervalo & Valuaciones \\ [0.5ex] 
        \midrule
        \num{1e-1}& 2& 1.2& 6\\
        \num{1e-2}& 2& 0.96& 9\\
        \num{1e-3}& 2& 0.768& 12\\
        \num{1e-4}& 2& 0.6144& 15\\
        \num{1e-5}& 2& 0.9830& 19\\
        \num{1e-6}& 2& 0.7864& 22\\
        \num{1e-7}& 2& 0.6291& 25\\
        \num{1e-8}& 2& 0.5033& 28\\
        \num{1e-9}& 2& 0.8053& 32\\
        \num{1e-10}& 2& 0.6442& 35\\
      \bottomrule
    \end{tabular} }
    \caption{Longitud del intervalo con respecto a $s$ en BM con $x=1/2$}
    \label{tab: s}
\end{table}

\begin{table}[H]
    \rowcolors{2}{gray!25}{white}
   \centering
    \resizebox{0.4\textwidth}{!}{
     \begin{tabular}{ccccc} 
      \toprule
       S & K & X & V \\ [0.5ex]
        \midrule
        \num{1e-2}& 2& 0.96& 9\\
        \num{1e-2}& 1.9& 0.7180& 9\\
        \num{1e-2}& 1.8& 0.5290& 9\\
        \num{1e-2}& 1.7& 0.6517& 10\\
        \num{1e-2}& 1.6& 0.4362& 10\\
        \num{1e-2}& 1.5& 0.4271& 11\\
        \num{1e-2}& 1.4& 0.3541& 12\\
        \num{1e-2}& 1.3& 0.3170& 14\\
        \num{1e-2}& 1.2& 0.1961& 16\\
        \num{1e-2}& 1.1& 0.1167& 22\\
      \bottomrule
    \end{tabular} } 
    \caption{Longitud del intervalo con respecto a $k$ en BM con $x=1/2$}
    \label{tab: k}
\end{table}

\subsection*{Fibonacci Search} %\emph{agrega esto}

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  


 \end{multicols*}
 \end{document} 

enter image description here

7

As it seems, source of the your problem is wish (requirement) to have resume in one column format but main text in two columns. This is simple to achieved by use of multicol package, but this have consequences with which you faces: multicol doesn't support floats. This you solve with use of H floats placement, which consequences is inserting white space in text, if floats haven't enough space to places on page where it is inserted in text.

What to do? You have three options:

  • manually move your tables in figures in text by trials so, that empty space will vanish
  • Instead of multicols use article with twocolumn option and insert article's title and summary (abstract) on separated one column text to which follows main text in two column format where you can use standard floats with htb placements' options:
\documentclass[a4paper,12pt,twocolumn, spanish]{article}
% preamble

\begin{document}
\onecolumn
\title{ Title}
\author{Alastor\\ UUC}
\date{\null
 }
\maketitle

\section*{Resumen}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.

\twocolumn
\section{Introducción}
% main text
\end{document}
  • or make (very) dirty trick in twocolumn document: insert your abstract into last maketitle field:
\documentclass[a4paper,12pt,twocolumn, spanish]{article}
%PAQUETES
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[left=1.5cm,top=1cm,right=1.5cm,bottom=1.5cm]{geometry}
\usepackage[osf]{newtxtext}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{siunitx}
%\usepackage{multicol}
\usepackage[table]{xcolor}
\definecolor{verde}{rgb}{0.55, 0.71, 0.0} %http://latexcolor.com/ para mas colorcitos
\definecolor{verde1}{rgb}{0.0, 0.5, 0.0}
\usepackage{graphicx}
\usepackage{enumerate}
\usepackage{booktabs, makecell}
\usepackage{float}
\usepackage{caption}
\usepackage{subcaption}
\captionsetup[subfigure]{labelformat=simple}
\renewcommand\thesubfigure{(\alph{subfigure})}

\usepackage{lipsum}

\usepackage[colorlinks=true,citecolor=verde1,linkcolor=black,urlcolor=verde1]{hyperref}

\begin{document}
\title{ Title}
\author{Alastor\\ UUC}
\date{\null
    \begin{minipage}{\textwidth}  % <-----------
    \section*{Resumen}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.
    \end{minipage}
}
\maketitle

\section{Introducción}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text

\section{Implementacion}

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\[
    \begin{multlined}[0.9\linewidth]
A(x) = -20\exp\left(-\frac{|x|}{5}\right)\\
        -\exp\left(\cos(2\pi x)\right) + 20 + \exp(1)
    \end{multlined}
\]
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text

\section{Resultados}

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text

\begin{table}[ht]
    \rowcolors{2}{gray!25}{white}
   \centering
     \begin{tabular}{S[table-format=1.0e1] c
                     S[table-format=1.4]
                     S[table-format=2.0]}
      \toprule
       {S} & {K} & {\makecell{Long. del\\ intervalo}} & {Valuaciones} \\
        \midrule
        1e-1    & 2 & 1.2    & 6\\
        1e-2    & 2 & 0.96   & 9\\
        1e-3    & 2 & 0.768  & 12\\
        1e-4    & 2 & 0.6144 & 15\\
        1e-5    & 2 & 0.9830 & 19\\
        1e-6    & 2 & 0.7864 & 22\\
        1e-7    & 2 & 0.6291 & 25\\
        1e-8    & 2 & 0.5033 & 28\\
        1e-9    & 2 & 0.8053 & 32\\
        1e-10   & 2 & 0.6442 & 35\\
      \specialrule{\heavyrulewidth}{0pt}{\belowrulesep}
    \end{tabular} 
    \caption{Longitud del intervalo con respecto a $s$ en BM con $x=1/2$}
    \label{tab: s}
\end{table}

\begin{table}[ht]
    \rowcolors{2}{gray!25}{white}
   \centering
     \begin{tabular}{S[table-format=1.0e1] 
                     S[table-format=1.1]
                     S[table-format=1.4]
                     S[table-format=2.0]}
      \toprule
       {S} & {K} & {X} & {V} \\
        \midrule
        1e-2    & 2     & 0.96      & 9\\
        1e-2    & 1.9   & 0.7180    & 9\\
        1e-2    & 1.8   & 0.5290    & 9\\
        1e-2    & 1.7   & 0.6517    & 10\\
        1e-2    & 1.6   & 0.4362    & 10\\
        1e-2    & 1.5   & 0.4271    & 11\\
        1e-2    & 1.4   & 0.3541    & 12\\
        1e-2    & 1.3   & 0.3170    & 14\\
        1e-2    & 1.2   & 0.1961    & 16\\
        1e-2    & 1.1   & 0.1167    & 22\\
      \specialrule{\heavyrulewidth}{0pt}{\belowrulesep}
    \end{tabular}
   \caption{Longitud del intervalo con respecto a $k$ en BM con $x=1/2$}
    \label{tab: k}
\end{table}

\subsection*{Fibonacci Search} %\emph{agrega esto}
\lipsum
 \end{document}

In above MWE I made some off-topic changes in tables and equation design.

enter image description here

1

Both the gap between your paragraphs/images and between the headings and text are due to them not fitting properly on the page. If you adjust the amount of text, for example in Resultados, it will all fit nicely (you can add \raggedbottom to allow Latex to relax a little about the bottoms of your pages as well).

When writing my thesis I have encountered this many times and the simplest way to control it is to adjust and move text if you want the location of your tables to be [H].

Google translate:

Tanto el espacio entre sus párrafos / imágenes como entre los encabezados y el texto se deben a que no encajan correctamente en la página. Si ajusta la cantidad de texto, por ejemplo en Resultados, todo encajará bien (puede agregar \raggedbottom para permitir que Latex también se relaje un poco en la parte inferior de sus páginas).

Al escribir mi tesis, me he encontrado con esto muchas veces y la forma más sencilla de controlarlo es ajustar y mover el texto si desea que la ubicación de sus tablas sea [H].

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .