TransWikia.com

Wrong arrangement of Table

TeX - LaTeX Asked by Walter Nazarenus on March 14, 2021

my Page starts with a picture then some text and after that i created a table. But after the build, the table is in front of the picture. At the beginning of the page…

newpage

begin{figure}[ht]
centering
includegraphics[scale=0.8]{./supply}
caption{Some Caption}
end{figure}

Text....
Text....
Text....

begin{table}
centering
begin{tabular}{|l|l|}
hline
Pin & Beschreibung  hline
Conn2.1 & Positive Versorgungsspannung hline
Conn2.2 & Ground hline
Conn2.3 & Negative Versorgungsspannung 
hline
end{tabular}
caption{other caption}
end{table}

newpage

2 Answers

Let me spell out my comment ... If you not specify position of floats (figure, table) they will float to the top of page, so your case you only need to specify positioning for table too:

documentclass{article}
usepackage{graphicx}
usepackage{lipsum} % for dummy text

begin{document}
begin{figure}[ht] % <---
centering
includegraphics[scale=0.8]{example-image-duck}%{./supply}
caption{Some Caption}
end{figure}
lipsum[1]

begin{table}[htb] % <---
centering
begin{tabular}{|l|l|}
hline
Pin & Beschreibung  hline
Conn2.1 & Positive Versorgungsspannung hline
Conn2.2 & Ground hline
Conn2.3 & Negative Versorgungsspannung
hline
end{tabular}
caption{other caption}
end{table}
end{document}

enter image description here

For details about float positioning and meaning of (positions) specifier h (here) , t (top), b (bottome) p (page); see comprehensive description in the Frank Mittelbach answer float positioning. BTW, it is recommended that you use h in pair with t or b etc, since otherwise can happen that float will be pushed to the end of document, if in the page after its inserting will not be enough space for it placement.

Correct answer by Zarko on March 14, 2021

enter image description here

documentclass{article}
usepackage{titlesec}
%1inch=25,4mm
%titlelabel{{hspace*{1cm}makebox[1cm][l]{thetitle}}}
%usepackage{indentfirst}
usepackage{lipsum}
usepackage{showframe}
usepackage[demo]{graphicx}
begin{document}
    newpage
    
    begin{figure}[]
        centering
        includegraphics[scale=0.8]{./supply}
        caption{Some Caption}
    end{figure}
    
    Text....
    Text....
    Text....
    
    begin{table}
        centering
        begin{tabular}{|l|l|}
            hline
            Pin & Beschreibung  hline
            Conn2.1 & Positive Versorgungsspannung hline
            Conn2.2 & Ground hline
            Conn2.3 & Negative Versorgungsspannung 
            hline
        end{tabular}
        caption{other caption}
    end{table}
    
    newpage
end{document}

EDIT

documentclass{article}
usepackage{titlesec}
%1inch=25,4mm
%titlelabel{{hspace*{1cm}makebox[1cm][l]{thetitle}}}
%usepackage{indentfirst}
usepackage{lipsum}
usepackage{showframe}
usepackage[demo]{graphicx}
begin{document}
    newpage
    
    begin{figure}[]
        centering
        includegraphics[scale=0.8]{./supply}
        caption{Some Caption}
    end{figure}
    
    Text....
    Text....
    Text....
    
    begin{table}[htbp]
        centering
        begin{tabular}{|l|l|}
            hline
            Pin & Beschreibung  hline
            Conn2.1 & Positive Versorgungsspannung hline
            Conn2.2 & Ground hline
            Conn2.3 & Negative Versorgungsspannung 
            hline
        end{tabular}
        caption{other caption}
    end{table}
    
    newpage
end{document}

enter image description here

Answered by js bibra on March 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP