add two horizontal lines between a figure and a table











up vote
0
down vote

favorite












I want to add two horizontal lines between each figure and each table but I have to add this command everytime : rule[0.6ex]{textwidth}{0.3mm}



And how can I reduce the red space between the caption and the figure ? Is there a way to put the figure and table in the center without adding begin{center} ... end{center} ? If I can do that, I won't have the red space anymore I guess.



MWE :



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{graphicx}
usepackage{hyperref}
usepackage{caption}
captionsetup{labelfont=bf,textfont=bf,justification=raggedright,singlelinecheck=false,format=hang}
begin{document}
begin{figure}
caption{Figure-Example.}
begin{center}
rule[0.6ex]{textwidth}{0.3mm}
includegraphics[scale=0.25]{logo.png}
rule[0.6ex]{textwidth}{0.3mm}
end{center}
textit{Source :} href{google.com}{https://google.com}
end{figure}
%Table :
begin{table}
caption{Table-Example.}
begin{center}
rule[0.6ex]{textwidth}{0.3mm}
begin{tabular}{c|c}
hline
A & B \
C & D \
hline
end{tabular}
rule[0.6ex]{textwidth}{0.3mm}
end{center}
textit{Source :} href{google.com}{https://google.com}
label{tab:my_label}
end{table}
end{document}


The result :



enter image description here










share|improve this question














bumped to the homepage by Community 2 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1




    Do not use the center environment within a figure: it adds unwanted vertical spacing. Use centering instead.
    – Bernard
    May 28 at 8:48












  • But if i use centering I will have my textit{Source :} href{google.com}{https://google.com} at the center as well.
    – Red One
    May 28 at 8:54










  • For that you can make a group. Captions are centred by default – how do you manage it?
    – Bernard
    May 28 at 9:00










  • Well i just tried something like this caption*{textit{Source} : href{google.com}{https://google.com}} with centering and it's not bad at all, so now I have to figure out how to add 2 lines without adding rule[0.6ex]{textwidth}{0.3mm} everytime.
    – Red One
    May 28 at 9:04






  • 1




    You should take a look at the documentation of the float package: it defines a ruled float style. You might define a ruledfigure and a ruledtable environments.
    – Bernard
    May 28 at 10:02















up vote
0
down vote

favorite












I want to add two horizontal lines between each figure and each table but I have to add this command everytime : rule[0.6ex]{textwidth}{0.3mm}



And how can I reduce the red space between the caption and the figure ? Is there a way to put the figure and table in the center without adding begin{center} ... end{center} ? If I can do that, I won't have the red space anymore I guess.



MWE :



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{graphicx}
usepackage{hyperref}
usepackage{caption}
captionsetup{labelfont=bf,textfont=bf,justification=raggedright,singlelinecheck=false,format=hang}
begin{document}
begin{figure}
caption{Figure-Example.}
begin{center}
rule[0.6ex]{textwidth}{0.3mm}
includegraphics[scale=0.25]{logo.png}
rule[0.6ex]{textwidth}{0.3mm}
end{center}
textit{Source :} href{google.com}{https://google.com}
end{figure}
%Table :
begin{table}
caption{Table-Example.}
begin{center}
rule[0.6ex]{textwidth}{0.3mm}
begin{tabular}{c|c}
hline
A & B \
C & D \
hline
end{tabular}
rule[0.6ex]{textwidth}{0.3mm}
end{center}
textit{Source :} href{google.com}{https://google.com}
label{tab:my_label}
end{table}
end{document}


The result :



enter image description here










share|improve this question














bumped to the homepage by Community 2 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1




    Do not use the center environment within a figure: it adds unwanted vertical spacing. Use centering instead.
    – Bernard
    May 28 at 8:48












  • But if i use centering I will have my textit{Source :} href{google.com}{https://google.com} at the center as well.
    – Red One
    May 28 at 8:54










  • For that you can make a group. Captions are centred by default – how do you manage it?
    – Bernard
    May 28 at 9:00










  • Well i just tried something like this caption*{textit{Source} : href{google.com}{https://google.com}} with centering and it's not bad at all, so now I have to figure out how to add 2 lines without adding rule[0.6ex]{textwidth}{0.3mm} everytime.
    – Red One
    May 28 at 9:04






  • 1




    You should take a look at the documentation of the float package: it defines a ruled float style. You might define a ruledfigure and a ruledtable environments.
    – Bernard
    May 28 at 10:02













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I want to add two horizontal lines between each figure and each table but I have to add this command everytime : rule[0.6ex]{textwidth}{0.3mm}



And how can I reduce the red space between the caption and the figure ? Is there a way to put the figure and table in the center without adding begin{center} ... end{center} ? If I can do that, I won't have the red space anymore I guess.



MWE :



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{graphicx}
usepackage{hyperref}
usepackage{caption}
captionsetup{labelfont=bf,textfont=bf,justification=raggedright,singlelinecheck=false,format=hang}
begin{document}
begin{figure}
caption{Figure-Example.}
begin{center}
rule[0.6ex]{textwidth}{0.3mm}
includegraphics[scale=0.25]{logo.png}
rule[0.6ex]{textwidth}{0.3mm}
end{center}
textit{Source :} href{google.com}{https://google.com}
end{figure}
%Table :
begin{table}
caption{Table-Example.}
begin{center}
rule[0.6ex]{textwidth}{0.3mm}
begin{tabular}{c|c}
hline
A & B \
C & D \
hline
end{tabular}
rule[0.6ex]{textwidth}{0.3mm}
end{center}
textit{Source :} href{google.com}{https://google.com}
label{tab:my_label}
end{table}
end{document}


The result :



enter image description here










share|improve this question













I want to add two horizontal lines between each figure and each table but I have to add this command everytime : rule[0.6ex]{textwidth}{0.3mm}



And how can I reduce the red space between the caption and the figure ? Is there a way to put the figure and table in the center without adding begin{center} ... end{center} ? If I can do that, I won't have the red space anymore I guess.



MWE :



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{graphicx}
usepackage{hyperref}
usepackage{caption}
captionsetup{labelfont=bf,textfont=bf,justification=raggedright,singlelinecheck=false,format=hang}
begin{document}
begin{figure}
caption{Figure-Example.}
begin{center}
rule[0.6ex]{textwidth}{0.3mm}
includegraphics[scale=0.25]{logo.png}
rule[0.6ex]{textwidth}{0.3mm}
end{center}
textit{Source :} href{google.com}{https://google.com}
end{figure}
%Table :
begin{table}
caption{Table-Example.}
begin{center}
rule[0.6ex]{textwidth}{0.3mm}
begin{tabular}{c|c}
hline
A & B \
C & D \
hline
end{tabular}
rule[0.6ex]{textwidth}{0.3mm}
end{center}
textit{Source :} href{google.com}{https://google.com}
label{tab:my_label}
end{table}
end{document}


The result :



enter image description here







floats captions






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 28 at 8:46









Red One

31619




31619





bumped to the homepage by Community 2 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 2 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 1




    Do not use the center environment within a figure: it adds unwanted vertical spacing. Use centering instead.
    – Bernard
    May 28 at 8:48












  • But if i use centering I will have my textit{Source :} href{google.com}{https://google.com} at the center as well.
    – Red One
    May 28 at 8:54










  • For that you can make a group. Captions are centred by default – how do you manage it?
    – Bernard
    May 28 at 9:00










  • Well i just tried something like this caption*{textit{Source} : href{google.com}{https://google.com}} with centering and it's not bad at all, so now I have to figure out how to add 2 lines without adding rule[0.6ex]{textwidth}{0.3mm} everytime.
    – Red One
    May 28 at 9:04






  • 1




    You should take a look at the documentation of the float package: it defines a ruled float style. You might define a ruledfigure and a ruledtable environments.
    – Bernard
    May 28 at 10:02














  • 1




    Do not use the center environment within a figure: it adds unwanted vertical spacing. Use centering instead.
    – Bernard
    May 28 at 8:48












  • But if i use centering I will have my textit{Source :} href{google.com}{https://google.com} at the center as well.
    – Red One
    May 28 at 8:54










  • For that you can make a group. Captions are centred by default – how do you manage it?
    – Bernard
    May 28 at 9:00










  • Well i just tried something like this caption*{textit{Source} : href{google.com}{https://google.com}} with centering and it's not bad at all, so now I have to figure out how to add 2 lines without adding rule[0.6ex]{textwidth}{0.3mm} everytime.
    – Red One
    May 28 at 9:04






  • 1




    You should take a look at the documentation of the float package: it defines a ruled float style. You might define a ruledfigure and a ruledtable environments.
    – Bernard
    May 28 at 10:02








1




1




Do not use the center environment within a figure: it adds unwanted vertical spacing. Use centering instead.
– Bernard
May 28 at 8:48






Do not use the center environment within a figure: it adds unwanted vertical spacing. Use centering instead.
– Bernard
May 28 at 8:48














But if i use centering I will have my textit{Source :} href{google.com}{https://google.com} at the center as well.
– Red One
May 28 at 8:54




But if i use centering I will have my textit{Source :} href{google.com}{https://google.com} at the center as well.
– Red One
May 28 at 8:54












For that you can make a group. Captions are centred by default – how do you manage it?
– Bernard
May 28 at 9:00




For that you can make a group. Captions are centred by default – how do you manage it?
– Bernard
May 28 at 9:00












Well i just tried something like this caption*{textit{Source} : href{google.com}{https://google.com}} with centering and it's not bad at all, so now I have to figure out how to add 2 lines without adding rule[0.6ex]{textwidth}{0.3mm} everytime.
– Red One
May 28 at 9:04




Well i just tried something like this caption*{textit{Source} : href{google.com}{https://google.com}} with centering and it's not bad at all, so now I have to figure out how to add 2 lines without adding rule[0.6ex]{textwidth}{0.3mm} everytime.
– Red One
May 28 at 9:04




1




1




You should take a look at the documentation of the float package: it defines a ruled float style. You might define a ruledfigure and a ruledtable environments.
– Bernard
May 28 at 10:02




You should take a look at the documentation of the float package: it defines a ruled float style. You might define a ruledfigure and a ruledtable environments.
– Bernard
May 28 at 10:02










1 Answer
1






active

oldest

votes

















up vote
0
down vote













With newenvironment{name}{begin}{end}, it can be done:



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{graphicx}
usepackage{hyperref}
usepackage{caption}
captionsetup{labelfont=bf,textfont=bf,justification=raggedright,singlelinecheck=false,format=hang}
newenvironment{tablewithrule}[2]{begin{table} caption{#1} centering rule[0.6ex]{textwidth}{0.3mm} caption*{textit{Source}: #2} }{vspace{1mm}rule[0.6ex]{textwidth}{0.3mm} end{table}}
begin{document}
begin{tablewithrule}{Table Example}{url{www.google.com}}
begin{tabular}{c|c}
hline
A & B \
C & D \
hline
end{tabular}
end{tablewithrule}
end{document}


However, it is not possible to have an argument in the end-part of the order. You've therefore to add it in the begin-part (if you want to have this automatic...).



The distance to the rules can be changed by vspace{}, where you can also enter a negative value, e.g. vspace{-0.4cm}



Edit: you could also work with renewenvironment instead of newenvironment. I however prefer not to meddle with the basic definitions but do new commands based on existing ones.






share|improve this answer





















  • Hello, sorry for the late answer. I tried it but it didn't work I don't get the lines between my figure/table when I add newenvironment{tablewithrule}[2]{begin{table} caption{#1} centering rule[0.6ex]{textwidth}{0.3mm} caption*{textit{Source}: #2} }{vspace{1mm}rule[0.6ex]{textwidth}{0.3mm} end{table}}
    – Red One
    May 28 at 22:56










  • Working fine with me. You've to change the begin{table} to begin{tablewithrule}, same with end{table}. If you don't want that, you've to use renewenvironment
    – Shade
    May 29 at 7:44











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f433763%2fadd-two-horizontal-lines-between-a-figure-and-a-table%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













With newenvironment{name}{begin}{end}, it can be done:



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{graphicx}
usepackage{hyperref}
usepackage{caption}
captionsetup{labelfont=bf,textfont=bf,justification=raggedright,singlelinecheck=false,format=hang}
newenvironment{tablewithrule}[2]{begin{table} caption{#1} centering rule[0.6ex]{textwidth}{0.3mm} caption*{textit{Source}: #2} }{vspace{1mm}rule[0.6ex]{textwidth}{0.3mm} end{table}}
begin{document}
begin{tablewithrule}{Table Example}{url{www.google.com}}
begin{tabular}{c|c}
hline
A & B \
C & D \
hline
end{tabular}
end{tablewithrule}
end{document}


However, it is not possible to have an argument in the end-part of the order. You've therefore to add it in the begin-part (if you want to have this automatic...).



The distance to the rules can be changed by vspace{}, where you can also enter a negative value, e.g. vspace{-0.4cm}



Edit: you could also work with renewenvironment instead of newenvironment. I however prefer not to meddle with the basic definitions but do new commands based on existing ones.






share|improve this answer





















  • Hello, sorry for the late answer. I tried it but it didn't work I don't get the lines between my figure/table when I add newenvironment{tablewithrule}[2]{begin{table} caption{#1} centering rule[0.6ex]{textwidth}{0.3mm} caption*{textit{Source}: #2} }{vspace{1mm}rule[0.6ex]{textwidth}{0.3mm} end{table}}
    – Red One
    May 28 at 22:56










  • Working fine with me. You've to change the begin{table} to begin{tablewithrule}, same with end{table}. If you don't want that, you've to use renewenvironment
    – Shade
    May 29 at 7:44















up vote
0
down vote













With newenvironment{name}{begin}{end}, it can be done:



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{graphicx}
usepackage{hyperref}
usepackage{caption}
captionsetup{labelfont=bf,textfont=bf,justification=raggedright,singlelinecheck=false,format=hang}
newenvironment{tablewithrule}[2]{begin{table} caption{#1} centering rule[0.6ex]{textwidth}{0.3mm} caption*{textit{Source}: #2} }{vspace{1mm}rule[0.6ex]{textwidth}{0.3mm} end{table}}
begin{document}
begin{tablewithrule}{Table Example}{url{www.google.com}}
begin{tabular}{c|c}
hline
A & B \
C & D \
hline
end{tabular}
end{tablewithrule}
end{document}


However, it is not possible to have an argument in the end-part of the order. You've therefore to add it in the begin-part (if you want to have this automatic...).



The distance to the rules can be changed by vspace{}, where you can also enter a negative value, e.g. vspace{-0.4cm}



Edit: you could also work with renewenvironment instead of newenvironment. I however prefer not to meddle with the basic definitions but do new commands based on existing ones.






share|improve this answer





















  • Hello, sorry for the late answer. I tried it but it didn't work I don't get the lines between my figure/table when I add newenvironment{tablewithrule}[2]{begin{table} caption{#1} centering rule[0.6ex]{textwidth}{0.3mm} caption*{textit{Source}: #2} }{vspace{1mm}rule[0.6ex]{textwidth}{0.3mm} end{table}}
    – Red One
    May 28 at 22:56










  • Working fine with me. You've to change the begin{table} to begin{tablewithrule}, same with end{table}. If you don't want that, you've to use renewenvironment
    – Shade
    May 29 at 7:44













up vote
0
down vote










up vote
0
down vote









With newenvironment{name}{begin}{end}, it can be done:



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{graphicx}
usepackage{hyperref}
usepackage{caption}
captionsetup{labelfont=bf,textfont=bf,justification=raggedright,singlelinecheck=false,format=hang}
newenvironment{tablewithrule}[2]{begin{table} caption{#1} centering rule[0.6ex]{textwidth}{0.3mm} caption*{textit{Source}: #2} }{vspace{1mm}rule[0.6ex]{textwidth}{0.3mm} end{table}}
begin{document}
begin{tablewithrule}{Table Example}{url{www.google.com}}
begin{tabular}{c|c}
hline
A & B \
C & D \
hline
end{tabular}
end{tablewithrule}
end{document}


However, it is not possible to have an argument in the end-part of the order. You've therefore to add it in the begin-part (if you want to have this automatic...).



The distance to the rules can be changed by vspace{}, where you can also enter a negative value, e.g. vspace{-0.4cm}



Edit: you could also work with renewenvironment instead of newenvironment. I however prefer not to meddle with the basic definitions but do new commands based on existing ones.






share|improve this answer












With newenvironment{name}{begin}{end}, it can be done:



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{graphicx}
usepackage{hyperref}
usepackage{caption}
captionsetup{labelfont=bf,textfont=bf,justification=raggedright,singlelinecheck=false,format=hang}
newenvironment{tablewithrule}[2]{begin{table} caption{#1} centering rule[0.6ex]{textwidth}{0.3mm} caption*{textit{Source}: #2} }{vspace{1mm}rule[0.6ex]{textwidth}{0.3mm} end{table}}
begin{document}
begin{tablewithrule}{Table Example}{url{www.google.com}}
begin{tabular}{c|c}
hline
A & B \
C & D \
hline
end{tabular}
end{tablewithrule}
end{document}


However, it is not possible to have an argument in the end-part of the order. You've therefore to add it in the begin-part (if you want to have this automatic...).



The distance to the rules can be changed by vspace{}, where you can also enter a negative value, e.g. vspace{-0.4cm}



Edit: you could also work with renewenvironment instead of newenvironment. I however prefer not to meddle with the basic definitions but do new commands based on existing ones.







share|improve this answer












share|improve this answer



share|improve this answer










answered May 28 at 10:05









Shade

3039




3039












  • Hello, sorry for the late answer. I tried it but it didn't work I don't get the lines between my figure/table when I add newenvironment{tablewithrule}[2]{begin{table} caption{#1} centering rule[0.6ex]{textwidth}{0.3mm} caption*{textit{Source}: #2} }{vspace{1mm}rule[0.6ex]{textwidth}{0.3mm} end{table}}
    – Red One
    May 28 at 22:56










  • Working fine with me. You've to change the begin{table} to begin{tablewithrule}, same with end{table}. If you don't want that, you've to use renewenvironment
    – Shade
    May 29 at 7:44


















  • Hello, sorry for the late answer. I tried it but it didn't work I don't get the lines between my figure/table when I add newenvironment{tablewithrule}[2]{begin{table} caption{#1} centering rule[0.6ex]{textwidth}{0.3mm} caption*{textit{Source}: #2} }{vspace{1mm}rule[0.6ex]{textwidth}{0.3mm} end{table}}
    – Red One
    May 28 at 22:56










  • Working fine with me. You've to change the begin{table} to begin{tablewithrule}, same with end{table}. If you don't want that, you've to use renewenvironment
    – Shade
    May 29 at 7:44
















Hello, sorry for the late answer. I tried it but it didn't work I don't get the lines between my figure/table when I add newenvironment{tablewithrule}[2]{begin{table} caption{#1} centering rule[0.6ex]{textwidth}{0.3mm} caption*{textit{Source}: #2} }{vspace{1mm}rule[0.6ex]{textwidth}{0.3mm} end{table}}
– Red One
May 28 at 22:56




Hello, sorry for the late answer. I tried it but it didn't work I don't get the lines between my figure/table when I add newenvironment{tablewithrule}[2]{begin{table} caption{#1} centering rule[0.6ex]{textwidth}{0.3mm} caption*{textit{Source}: #2} }{vspace{1mm}rule[0.6ex]{textwidth}{0.3mm} end{table}}
– Red One
May 28 at 22:56












Working fine with me. You've to change the begin{table} to begin{tablewithrule}, same with end{table}. If you don't want that, you've to use renewenvironment
– Shade
May 29 at 7:44




Working fine with me. You've to change the begin{table} to begin{tablewithrule}, same with end{table}. If you don't want that, you've to use renewenvironment
– Shade
May 29 at 7:44


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f433763%2fadd-two-horizontal-lines-between-a-figure-and-a-table%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)