How to format table title width and position












0















I am generating PDF documentation from rst files using sphinx, latex and latexpdf. The rst files include wide tables with long table titles using "csv-table". I would like the table title to print in one long line instead of wrapping. How can I set the width of the table title to match the width of the table and control the title alignment (e.g. left vs center)?



Note - the width of the table is fills the width of the pdf output page as desired. The width and alignment of the table title is the issue.



I've tried searching sphinx documentation and online for ways to update the rst files or the conf.py file. Not sure where to look next.



Here is what I have in the rst file:



.. csv-table:: Very long table title that is shorter than the width of the table
:file: filename.csv
:header-rows: 1
:class: longtable
:widths: 30 70


Note, my tex file already has the following line:



caption{Very long table title that is shorter than the width of the table
)strut}label{detokenize{foo:id1}}\*[sphinxlongtablecapskipadjust]









share|improve this question




















  • 5





    Welcome :) could you provide some code showing what you have tried so far?

    – Superuser27
    Mar 26 at 15:46











  • Ok, but what are you trying to do in your tex file? :)

    – Superuser27
    Mar 26 at 18:24











  • Hi - that snippet I have in the original comment is what I actually have in the rst file. filename.csv has: ``` Name,Description NameA, This is a description of NameA. NameB, This is a description of NameB. ``` I am not sure where to look next. I have a conf.py file with: ``` latex_elements = {} ``` This seemed like it might be a place to set the table title character width, but I don't see any way to do that in the documentation for latex_elements under: sphinx-doc.org/en/1.8/usage/configuration.html I am using Sphinx version 1.8.

    – AJK
    Mar 26 at 18:31











  • thank you...let me find the tex file and research how to use it. I will come back if I figure it out or have more questions.

    – AJK
    Mar 26 at 18:32
















0















I am generating PDF documentation from rst files using sphinx, latex and latexpdf. The rst files include wide tables with long table titles using "csv-table". I would like the table title to print in one long line instead of wrapping. How can I set the width of the table title to match the width of the table and control the title alignment (e.g. left vs center)?



Note - the width of the table is fills the width of the pdf output page as desired. The width and alignment of the table title is the issue.



I've tried searching sphinx documentation and online for ways to update the rst files or the conf.py file. Not sure where to look next.



Here is what I have in the rst file:



.. csv-table:: Very long table title that is shorter than the width of the table
:file: filename.csv
:header-rows: 1
:class: longtable
:widths: 30 70


Note, my tex file already has the following line:



caption{Very long table title that is shorter than the width of the table
)strut}label{detokenize{foo:id1}}\*[sphinxlongtablecapskipadjust]









share|improve this question




















  • 5





    Welcome :) could you provide some code showing what you have tried so far?

    – Superuser27
    Mar 26 at 15:46











  • Ok, but what are you trying to do in your tex file? :)

    – Superuser27
    Mar 26 at 18:24











  • Hi - that snippet I have in the original comment is what I actually have in the rst file. filename.csv has: ``` Name,Description NameA, This is a description of NameA. NameB, This is a description of NameB. ``` I am not sure where to look next. I have a conf.py file with: ``` latex_elements = {} ``` This seemed like it might be a place to set the table title character width, but I don't see any way to do that in the documentation for latex_elements under: sphinx-doc.org/en/1.8/usage/configuration.html I am using Sphinx version 1.8.

    – AJK
    Mar 26 at 18:31











  • thank you...let me find the tex file and research how to use it. I will come back if I figure it out or have more questions.

    – AJK
    Mar 26 at 18:32














0












0








0


0






I am generating PDF documentation from rst files using sphinx, latex and latexpdf. The rst files include wide tables with long table titles using "csv-table". I would like the table title to print in one long line instead of wrapping. How can I set the width of the table title to match the width of the table and control the title alignment (e.g. left vs center)?



Note - the width of the table is fills the width of the pdf output page as desired. The width and alignment of the table title is the issue.



I've tried searching sphinx documentation and online for ways to update the rst files or the conf.py file. Not sure where to look next.



Here is what I have in the rst file:



.. csv-table:: Very long table title that is shorter than the width of the table
:file: filename.csv
:header-rows: 1
:class: longtable
:widths: 30 70


Note, my tex file already has the following line:



caption{Very long table title that is shorter than the width of the table
)strut}label{detokenize{foo:id1}}\*[sphinxlongtablecapskipadjust]









share|improve this question
















I am generating PDF documentation from rst files using sphinx, latex and latexpdf. The rst files include wide tables with long table titles using "csv-table". I would like the table title to print in one long line instead of wrapping. How can I set the width of the table title to match the width of the table and control the title alignment (e.g. left vs center)?



Note - the width of the table is fills the width of the pdf output page as desired. The width and alignment of the table title is the issue.



I've tried searching sphinx documentation and online for ways to update the rst files or the conf.py file. Not sure where to look next.



Here is what I have in the rst file:



.. csv-table:: Very long table title that is shorter than the width of the table
:file: filename.csv
:header-rows: 1
:class: longtable
:widths: 30 70


Note, my tex file already has the following line:



caption{Very long table title that is shorter than the width of the table
)strut}label{detokenize{foo:id1}}\*[sphinxlongtablecapskipadjust]






tables horizontal-alignment width






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 16:12







AJK

















asked Mar 26 at 15:42









AJKAJK

61




61








  • 5





    Welcome :) could you provide some code showing what you have tried so far?

    – Superuser27
    Mar 26 at 15:46











  • Ok, but what are you trying to do in your tex file? :)

    – Superuser27
    Mar 26 at 18:24











  • Hi - that snippet I have in the original comment is what I actually have in the rst file. filename.csv has: ``` Name,Description NameA, This is a description of NameA. NameB, This is a description of NameB. ``` I am not sure where to look next. I have a conf.py file with: ``` latex_elements = {} ``` This seemed like it might be a place to set the table title character width, but I don't see any way to do that in the documentation for latex_elements under: sphinx-doc.org/en/1.8/usage/configuration.html I am using Sphinx version 1.8.

    – AJK
    Mar 26 at 18:31











  • thank you...let me find the tex file and research how to use it. I will come back if I figure it out or have more questions.

    – AJK
    Mar 26 at 18:32














  • 5





    Welcome :) could you provide some code showing what you have tried so far?

    – Superuser27
    Mar 26 at 15:46











  • Ok, but what are you trying to do in your tex file? :)

    – Superuser27
    Mar 26 at 18:24











  • Hi - that snippet I have in the original comment is what I actually have in the rst file. filename.csv has: ``` Name,Description NameA, This is a description of NameA. NameB, This is a description of NameB. ``` I am not sure where to look next. I have a conf.py file with: ``` latex_elements = {} ``` This seemed like it might be a place to set the table title character width, but I don't see any way to do that in the documentation for latex_elements under: sphinx-doc.org/en/1.8/usage/configuration.html I am using Sphinx version 1.8.

    – AJK
    Mar 26 at 18:31











  • thank you...let me find the tex file and research how to use it. I will come back if I figure it out or have more questions.

    – AJK
    Mar 26 at 18:32








5




5





Welcome :) could you provide some code showing what you have tried so far?

– Superuser27
Mar 26 at 15:46





Welcome :) could you provide some code showing what you have tried so far?

– Superuser27
Mar 26 at 15:46













Ok, but what are you trying to do in your tex file? :)

– Superuser27
Mar 26 at 18:24





Ok, but what are you trying to do in your tex file? :)

– Superuser27
Mar 26 at 18:24













Hi - that snippet I have in the original comment is what I actually have in the rst file. filename.csv has: ``` Name,Description NameA, This is a description of NameA. NameB, This is a description of NameB. ``` I am not sure where to look next. I have a conf.py file with: ``` latex_elements = {} ``` This seemed like it might be a place to set the table title character width, but I don't see any way to do that in the documentation for latex_elements under: sphinx-doc.org/en/1.8/usage/configuration.html I am using Sphinx version 1.8.

– AJK
Mar 26 at 18:31





Hi - that snippet I have in the original comment is what I actually have in the rst file. filename.csv has: ``` Name,Description NameA, This is a description of NameA. NameB, This is a description of NameB. ``` I am not sure where to look next. I have a conf.py file with: ``` latex_elements = {} ``` This seemed like it might be a place to set the table title character width, but I don't see any way to do that in the documentation for latex_elements under: sphinx-doc.org/en/1.8/usage/configuration.html I am using Sphinx version 1.8.

– AJK
Mar 26 at 18:31













thank you...let me find the tex file and research how to use it. I will come back if I figure it out or have more questions.

– AJK
Mar 26 at 18:32





thank you...let me find the tex file and research how to use it. I will come back if I figure it out or have more questions.

– AJK
Mar 26 at 18:32










1 Answer
1






active

oldest

votes


















0














Thank you for the pointer to the tex file! The wrapping issue was fixed after I added the following line in the tex file and then regenerated the pdf files:



usepackage{caption}


However, my tex file is generated in my build process, so that couldn’t be my final fix.



Adding the following line in my conf.py file fixed the wrapping issue. After I made this update in conf.py, the tex file that is generated and used when I run latex & latexpdf includes “usepackage{caption}”.



 latex_elements = {
'preamble': '\usepackage{caption}'
}


Regarding the alignment of the table caption (title), I found the following duplicate question whose answer works for me too:
Table caption should be left aligned



So now, all of my question has been answered. Thank you for the pointers.






share|improve this answer


























  • hm, is this an answer? it seems that only clarify your question, so it should be moved there.

    – Zarko
    Mar 26 at 23:01











  • Hi Zarko - yes, that answer fixed the issue for me. (After I updated my conf.py file as described in the answer above, the table caption no longer wraps.) The note I had in the answer was clarification, so I moved it from the answer to the question. That note was something I discovered, not changed, after following up on Superuser27's comment. Thank you both for the responses.

    – AJK
    Mar 27 at 16:11














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',
autoActivateHeartbeat: false,
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%2f481547%2fhow-to-format-table-title-width-and-position%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









0














Thank you for the pointer to the tex file! The wrapping issue was fixed after I added the following line in the tex file and then regenerated the pdf files:



usepackage{caption}


However, my tex file is generated in my build process, so that couldn’t be my final fix.



Adding the following line in my conf.py file fixed the wrapping issue. After I made this update in conf.py, the tex file that is generated and used when I run latex & latexpdf includes “usepackage{caption}”.



 latex_elements = {
'preamble': '\usepackage{caption}'
}


Regarding the alignment of the table caption (title), I found the following duplicate question whose answer works for me too:
Table caption should be left aligned



So now, all of my question has been answered. Thank you for the pointers.






share|improve this answer


























  • hm, is this an answer? it seems that only clarify your question, so it should be moved there.

    – Zarko
    Mar 26 at 23:01











  • Hi Zarko - yes, that answer fixed the issue for me. (After I updated my conf.py file as described in the answer above, the table caption no longer wraps.) The note I had in the answer was clarification, so I moved it from the answer to the question. That note was something I discovered, not changed, after following up on Superuser27's comment. Thank you both for the responses.

    – AJK
    Mar 27 at 16:11


















0














Thank you for the pointer to the tex file! The wrapping issue was fixed after I added the following line in the tex file and then regenerated the pdf files:



usepackage{caption}


However, my tex file is generated in my build process, so that couldn’t be my final fix.



Adding the following line in my conf.py file fixed the wrapping issue. After I made this update in conf.py, the tex file that is generated and used when I run latex & latexpdf includes “usepackage{caption}”.



 latex_elements = {
'preamble': '\usepackage{caption}'
}


Regarding the alignment of the table caption (title), I found the following duplicate question whose answer works for me too:
Table caption should be left aligned



So now, all of my question has been answered. Thank you for the pointers.






share|improve this answer


























  • hm, is this an answer? it seems that only clarify your question, so it should be moved there.

    – Zarko
    Mar 26 at 23:01











  • Hi Zarko - yes, that answer fixed the issue for me. (After I updated my conf.py file as described in the answer above, the table caption no longer wraps.) The note I had in the answer was clarification, so I moved it from the answer to the question. That note was something I discovered, not changed, after following up on Superuser27's comment. Thank you both for the responses.

    – AJK
    Mar 27 at 16:11
















0












0








0







Thank you for the pointer to the tex file! The wrapping issue was fixed after I added the following line in the tex file and then regenerated the pdf files:



usepackage{caption}


However, my tex file is generated in my build process, so that couldn’t be my final fix.



Adding the following line in my conf.py file fixed the wrapping issue. After I made this update in conf.py, the tex file that is generated and used when I run latex & latexpdf includes “usepackage{caption}”.



 latex_elements = {
'preamble': '\usepackage{caption}'
}


Regarding the alignment of the table caption (title), I found the following duplicate question whose answer works for me too:
Table caption should be left aligned



So now, all of my question has been answered. Thank you for the pointers.






share|improve this answer















Thank you for the pointer to the tex file! The wrapping issue was fixed after I added the following line in the tex file and then regenerated the pdf files:



usepackage{caption}


However, my tex file is generated in my build process, so that couldn’t be my final fix.



Adding the following line in my conf.py file fixed the wrapping issue. After I made this update in conf.py, the tex file that is generated and used when I run latex & latexpdf includes “usepackage{caption}”.



 latex_elements = {
'preamble': '\usepackage{caption}'
}


Regarding the alignment of the table caption (title), I found the following duplicate question whose answer works for me too:
Table caption should be left aligned



So now, all of my question has been answered. Thank you for the pointers.







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 27 at 16:05

























answered Mar 26 at 21:41









AJKAJK

61




61













  • hm, is this an answer? it seems that only clarify your question, so it should be moved there.

    – Zarko
    Mar 26 at 23:01











  • Hi Zarko - yes, that answer fixed the issue for me. (After I updated my conf.py file as described in the answer above, the table caption no longer wraps.) The note I had in the answer was clarification, so I moved it from the answer to the question. That note was something I discovered, not changed, after following up on Superuser27's comment. Thank you both for the responses.

    – AJK
    Mar 27 at 16:11





















  • hm, is this an answer? it seems that only clarify your question, so it should be moved there.

    – Zarko
    Mar 26 at 23:01











  • Hi Zarko - yes, that answer fixed the issue for me. (After I updated my conf.py file as described in the answer above, the table caption no longer wraps.) The note I had in the answer was clarification, so I moved it from the answer to the question. That note was something I discovered, not changed, after following up on Superuser27's comment. Thank you both for the responses.

    – AJK
    Mar 27 at 16:11



















hm, is this an answer? it seems that only clarify your question, so it should be moved there.

– Zarko
Mar 26 at 23:01





hm, is this an answer? it seems that only clarify your question, so it should be moved there.

– Zarko
Mar 26 at 23:01













Hi Zarko - yes, that answer fixed the issue for me. (After I updated my conf.py file as described in the answer above, the table caption no longer wraps.) The note I had in the answer was clarification, so I moved it from the answer to the question. That note was something I discovered, not changed, after following up on Superuser27's comment. Thank you both for the responses.

– AJK
Mar 27 at 16:11







Hi Zarko - yes, that answer fixed the issue for me. (After I updated my conf.py file as described in the answer above, the table caption no longer wraps.) The note I had in the answer was clarification, so I moved it from the answer to the question. That note was something I discovered, not changed, after following up on Superuser27's comment. Thank you both for the responses.

– AJK
Mar 27 at 16:11




















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f481547%2fhow-to-format-table-title-width-and-position%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

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?