How to split the text into two columns that both have a different width?












6














I'm making a report about some code that I've written. I want to split the page into two columns, in such a way that I have code on the left side and (commentary, descriptive, non-code) text on right side.



I do not want to have this layout throughout the whole document.



I would also like to have a vertical line that
separates these two columns.



The important part for me is that I want the code column to occupy a lot more space than the text column. The code-columnwidth should be twice as much as the text-columnwith for example.



I have searched the internet for a long time but I couldn't find a suitable solution.



I have tried the following:



usepackage{multicol}
setlength{columnsep}{1cm}
setlength{columnseprule}{1pt}
defcolumnseprulecolor{color{black}}

begin{document}

begin{multicols}{2}
text..
end{multicols}

end{document}


But it can't seem to find a way to specify two different columnwidths for each column. What also bothers me is that I cannot indicate precisely what text goes into what column, it just splits it automatically when the bottom of the page is reached, meaning that I sometimes get code on the right column.



Could anyone help me with this problem? I truly am desperate for any kind of solution. Thank you!










share|improve this question







New contributor




Chiron is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    Welcome to TeX.SE. Are you familiar with the paracol package?
    – Mico
    2 days ago












  • Take a look at the ‘tcolorbox‘ package
    – Hafid Boukhoulda
    2 days ago








  • 1




    Package paracol can take care of that.
    – Bernard
    2 days ago






  • 1




    Would it be possible to mock up an example of what you're looking for? For example, it should show how the two columns interact with one another. Do you have long pieces of text that should push the code (on the left) down? Should the text be centred vertically with respect to the code or at the top of the code line it describes? Do you need word wrapping for the text? What package are you using to write the code?
    – Werner
    2 days ago










  • Thank you all for your efforts! The paracol package has exactly what I was looking for.
    – Chiron
    2 days ago
















6














I'm making a report about some code that I've written. I want to split the page into two columns, in such a way that I have code on the left side and (commentary, descriptive, non-code) text on right side.



I do not want to have this layout throughout the whole document.



I would also like to have a vertical line that
separates these two columns.



The important part for me is that I want the code column to occupy a lot more space than the text column. The code-columnwidth should be twice as much as the text-columnwith for example.



I have searched the internet for a long time but I couldn't find a suitable solution.



I have tried the following:



usepackage{multicol}
setlength{columnsep}{1cm}
setlength{columnseprule}{1pt}
defcolumnseprulecolor{color{black}}

begin{document}

begin{multicols}{2}
text..
end{multicols}

end{document}


But it can't seem to find a way to specify two different columnwidths for each column. What also bothers me is that I cannot indicate precisely what text goes into what column, it just splits it automatically when the bottom of the page is reached, meaning that I sometimes get code on the right column.



Could anyone help me with this problem? I truly am desperate for any kind of solution. Thank you!










share|improve this question







New contributor




Chiron is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    Welcome to TeX.SE. Are you familiar with the paracol package?
    – Mico
    2 days ago












  • Take a look at the ‘tcolorbox‘ package
    – Hafid Boukhoulda
    2 days ago








  • 1




    Package paracol can take care of that.
    – Bernard
    2 days ago






  • 1




    Would it be possible to mock up an example of what you're looking for? For example, it should show how the two columns interact with one another. Do you have long pieces of text that should push the code (on the left) down? Should the text be centred vertically with respect to the code or at the top of the code line it describes? Do you need word wrapping for the text? What package are you using to write the code?
    – Werner
    2 days ago










  • Thank you all for your efforts! The paracol package has exactly what I was looking for.
    – Chiron
    2 days ago














6












6








6


1





I'm making a report about some code that I've written. I want to split the page into two columns, in such a way that I have code on the left side and (commentary, descriptive, non-code) text on right side.



I do not want to have this layout throughout the whole document.



I would also like to have a vertical line that
separates these two columns.



The important part for me is that I want the code column to occupy a lot more space than the text column. The code-columnwidth should be twice as much as the text-columnwith for example.



I have searched the internet for a long time but I couldn't find a suitable solution.



I have tried the following:



usepackage{multicol}
setlength{columnsep}{1cm}
setlength{columnseprule}{1pt}
defcolumnseprulecolor{color{black}}

begin{document}

begin{multicols}{2}
text..
end{multicols}

end{document}


But it can't seem to find a way to specify two different columnwidths for each column. What also bothers me is that I cannot indicate precisely what text goes into what column, it just splits it automatically when the bottom of the page is reached, meaning that I sometimes get code on the right column.



Could anyone help me with this problem? I truly am desperate for any kind of solution. Thank you!










share|improve this question







New contributor




Chiron is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I'm making a report about some code that I've written. I want to split the page into two columns, in such a way that I have code on the left side and (commentary, descriptive, non-code) text on right side.



I do not want to have this layout throughout the whole document.



I would also like to have a vertical line that
separates these two columns.



The important part for me is that I want the code column to occupy a lot more space than the text column. The code-columnwidth should be twice as much as the text-columnwith for example.



I have searched the internet for a long time but I couldn't find a suitable solution.



I have tried the following:



usepackage{multicol}
setlength{columnsep}{1cm}
setlength{columnseprule}{1pt}
defcolumnseprulecolor{color{black}}

begin{document}

begin{multicols}{2}
text..
end{multicols}

end{document}


But it can't seem to find a way to specify two different columnwidths for each column. What also bothers me is that I cannot indicate precisely what text goes into what column, it just splits it automatically when the bottom of the page is reached, meaning that I sometimes get code on the right column.



Could anyone help me with this problem? I truly am desperate for any kind of solution. Thank you!







two-column columns layout






share|improve this question







New contributor




Chiron is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Chiron is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Chiron is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









ChironChiron

313




313




New contributor




Chiron is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Chiron is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Chiron is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1




    Welcome to TeX.SE. Are you familiar with the paracol package?
    – Mico
    2 days ago












  • Take a look at the ‘tcolorbox‘ package
    – Hafid Boukhoulda
    2 days ago








  • 1




    Package paracol can take care of that.
    – Bernard
    2 days ago






  • 1




    Would it be possible to mock up an example of what you're looking for? For example, it should show how the two columns interact with one another. Do you have long pieces of text that should push the code (on the left) down? Should the text be centred vertically with respect to the code or at the top of the code line it describes? Do you need word wrapping for the text? What package are you using to write the code?
    – Werner
    2 days ago










  • Thank you all for your efforts! The paracol package has exactly what I was looking for.
    – Chiron
    2 days ago














  • 1




    Welcome to TeX.SE. Are you familiar with the paracol package?
    – Mico
    2 days ago












  • Take a look at the ‘tcolorbox‘ package
    – Hafid Boukhoulda
    2 days ago








  • 1




    Package paracol can take care of that.
    – Bernard
    2 days ago






  • 1




    Would it be possible to mock up an example of what you're looking for? For example, it should show how the two columns interact with one another. Do you have long pieces of text that should push the code (on the left) down? Should the text be centred vertically with respect to the code or at the top of the code line it describes? Do you need word wrapping for the text? What package are you using to write the code?
    – Werner
    2 days ago










  • Thank you all for your efforts! The paracol package has exactly what I was looking for.
    – Chiron
    2 days ago








1




1




Welcome to TeX.SE. Are you familiar with the paracol package?
– Mico
2 days ago






Welcome to TeX.SE. Are you familiar with the paracol package?
– Mico
2 days ago














Take a look at the ‘tcolorbox‘ package
– Hafid Boukhoulda
2 days ago






Take a look at the ‘tcolorbox‘ package
– Hafid Boukhoulda
2 days ago






1




1




Package paracol can take care of that.
– Bernard
2 days ago




Package paracol can take care of that.
– Bernard
2 days ago




1




1




Would it be possible to mock up an example of what you're looking for? For example, it should show how the two columns interact with one another. Do you have long pieces of text that should push the code (on the left) down? Should the text be centred vertically with respect to the code or at the top of the code line it describes? Do you need word wrapping for the text? What package are you using to write the code?
– Werner
2 days ago




Would it be possible to mock up an example of what you're looking for? For example, it should show how the two columns interact with one another. Do you have long pieces of text that should push the code (on the left) down? Should the text be centred vertically with respect to the code or at the top of the code line it describes? Do you need word wrapping for the text? What package are you using to write the code?
– Werner
2 days ago












Thank you all for your efforts! The paracol package has exactly what I was looking for.
– Chiron
2 days ago




Thank you all for your efforts! The paracol package has exactly what I was looking for.
– Chiron
2 days ago










1 Answer
1






active

oldest

votes


















6














A simple minipage solution might be more suitable in your case if you don't require page breaks (you didn't mention this as a requirement in your question), otherwise you can have a look at the paracol package mentioned by Mico in the comments.



documentclass{article}
usepackage[margin=1.5in,showframe]{geometry}
usepackage{lipsum}

begin{document}
lipsum[1-5]clearpage

noindent
begin{minipage}[t]{0.6textwidth}
lipsum*[1-2]
end{minipage}%
hfill
vrule
hfill
begin{minipage}[t]{0.3textwidth}
lipsum*[1]
end{minipage}

clearpage
lipsum[1-5]

newpage
end{document}




This way you can put whatever you like in the left column (code, in your case), and the descriptive text on the right.






share|improve this answer



















  • 2




    +1. :-) To assure that the vertical rule is centered between the minipage environments, it's important to write end{minipage}% rather than just end{minipage}. The % (comment) symbol serves to suppress the whitespace that otherwise gets inserted (as is visible in the screenshot you posted).
    – Mico
    2 days ago












  • @Mico Thank you for the comment, I'll correct it.
    – Troy
    2 days ago










  • I decided on the paracol package as it is simpler in my opinion and provides exactly everything I was looking for and more (including synchronized columns, etc.) Nevertheless, thank you so much for your efforts!
    – Chiron
    2 days ago













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
});


}
});






Chiron is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468722%2fhow-to-split-the-text-into-two-columns-that-both-have-a-different-width%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









6














A simple minipage solution might be more suitable in your case if you don't require page breaks (you didn't mention this as a requirement in your question), otherwise you can have a look at the paracol package mentioned by Mico in the comments.



documentclass{article}
usepackage[margin=1.5in,showframe]{geometry}
usepackage{lipsum}

begin{document}
lipsum[1-5]clearpage

noindent
begin{minipage}[t]{0.6textwidth}
lipsum*[1-2]
end{minipage}%
hfill
vrule
hfill
begin{minipage}[t]{0.3textwidth}
lipsum*[1]
end{minipage}

clearpage
lipsum[1-5]

newpage
end{document}




This way you can put whatever you like in the left column (code, in your case), and the descriptive text on the right.






share|improve this answer



















  • 2




    +1. :-) To assure that the vertical rule is centered between the minipage environments, it's important to write end{minipage}% rather than just end{minipage}. The % (comment) symbol serves to suppress the whitespace that otherwise gets inserted (as is visible in the screenshot you posted).
    – Mico
    2 days ago












  • @Mico Thank you for the comment, I'll correct it.
    – Troy
    2 days ago










  • I decided on the paracol package as it is simpler in my opinion and provides exactly everything I was looking for and more (including synchronized columns, etc.) Nevertheless, thank you so much for your efforts!
    – Chiron
    2 days ago


















6














A simple minipage solution might be more suitable in your case if you don't require page breaks (you didn't mention this as a requirement in your question), otherwise you can have a look at the paracol package mentioned by Mico in the comments.



documentclass{article}
usepackage[margin=1.5in,showframe]{geometry}
usepackage{lipsum}

begin{document}
lipsum[1-5]clearpage

noindent
begin{minipage}[t]{0.6textwidth}
lipsum*[1-2]
end{minipage}%
hfill
vrule
hfill
begin{minipage}[t]{0.3textwidth}
lipsum*[1]
end{minipage}

clearpage
lipsum[1-5]

newpage
end{document}




This way you can put whatever you like in the left column (code, in your case), and the descriptive text on the right.






share|improve this answer



















  • 2




    +1. :-) To assure that the vertical rule is centered between the minipage environments, it's important to write end{minipage}% rather than just end{minipage}. The % (comment) symbol serves to suppress the whitespace that otherwise gets inserted (as is visible in the screenshot you posted).
    – Mico
    2 days ago












  • @Mico Thank you for the comment, I'll correct it.
    – Troy
    2 days ago










  • I decided on the paracol package as it is simpler in my opinion and provides exactly everything I was looking for and more (including synchronized columns, etc.) Nevertheless, thank you so much for your efforts!
    – Chiron
    2 days ago
















6












6








6






A simple minipage solution might be more suitable in your case if you don't require page breaks (you didn't mention this as a requirement in your question), otherwise you can have a look at the paracol package mentioned by Mico in the comments.



documentclass{article}
usepackage[margin=1.5in,showframe]{geometry}
usepackage{lipsum}

begin{document}
lipsum[1-5]clearpage

noindent
begin{minipage}[t]{0.6textwidth}
lipsum*[1-2]
end{minipage}%
hfill
vrule
hfill
begin{minipage}[t]{0.3textwidth}
lipsum*[1]
end{minipage}

clearpage
lipsum[1-5]

newpage
end{document}




This way you can put whatever you like in the left column (code, in your case), and the descriptive text on the right.






share|improve this answer














A simple minipage solution might be more suitable in your case if you don't require page breaks (you didn't mention this as a requirement in your question), otherwise you can have a look at the paracol package mentioned by Mico in the comments.



documentclass{article}
usepackage[margin=1.5in,showframe]{geometry}
usepackage{lipsum}

begin{document}
lipsum[1-5]clearpage

noindent
begin{minipage}[t]{0.6textwidth}
lipsum*[1-2]
end{minipage}%
hfill
vrule
hfill
begin{minipage}[t]{0.3textwidth}
lipsum*[1]
end{minipage}

clearpage
lipsum[1-5]

newpage
end{document}




This way you can put whatever you like in the left column (code, in your case), and the descriptive text on the right.







share|improve this answer














share|improve this answer



share|improve this answer








edited 2 days ago

























answered 2 days ago









TroyTroy

10.9k62267




10.9k62267








  • 2




    +1. :-) To assure that the vertical rule is centered between the minipage environments, it's important to write end{minipage}% rather than just end{minipage}. The % (comment) symbol serves to suppress the whitespace that otherwise gets inserted (as is visible in the screenshot you posted).
    – Mico
    2 days ago












  • @Mico Thank you for the comment, I'll correct it.
    – Troy
    2 days ago










  • I decided on the paracol package as it is simpler in my opinion and provides exactly everything I was looking for and more (including synchronized columns, etc.) Nevertheless, thank you so much for your efforts!
    – Chiron
    2 days ago
















  • 2




    +1. :-) To assure that the vertical rule is centered between the minipage environments, it's important to write end{minipage}% rather than just end{minipage}. The % (comment) symbol serves to suppress the whitespace that otherwise gets inserted (as is visible in the screenshot you posted).
    – Mico
    2 days ago












  • @Mico Thank you for the comment, I'll correct it.
    – Troy
    2 days ago










  • I decided on the paracol package as it is simpler in my opinion and provides exactly everything I was looking for and more (including synchronized columns, etc.) Nevertheless, thank you so much for your efforts!
    – Chiron
    2 days ago










2




2




+1. :-) To assure that the vertical rule is centered between the minipage environments, it's important to write end{minipage}% rather than just end{minipage}. The % (comment) symbol serves to suppress the whitespace that otherwise gets inserted (as is visible in the screenshot you posted).
– Mico
2 days ago






+1. :-) To assure that the vertical rule is centered between the minipage environments, it's important to write end{minipage}% rather than just end{minipage}. The % (comment) symbol serves to suppress the whitespace that otherwise gets inserted (as is visible in the screenshot you posted).
– Mico
2 days ago














@Mico Thank you for the comment, I'll correct it.
– Troy
2 days ago




@Mico Thank you for the comment, I'll correct it.
– Troy
2 days ago












I decided on the paracol package as it is simpler in my opinion and provides exactly everything I was looking for and more (including synchronized columns, etc.) Nevertheless, thank you so much for your efforts!
– Chiron
2 days ago






I decided on the paracol package as it is simpler in my opinion and provides exactly everything I was looking for and more (including synchronized columns, etc.) Nevertheless, thank you so much for your efforts!
– Chiron
2 days ago












Chiron is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Chiron is a new contributor. Be nice, and check out our Code of Conduct.













Chiron is a new contributor. Be nice, and check out our Code of Conduct.












Chiron is a new contributor. Be nice, and check out our Code of Conduct.
















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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2f468722%2fhow-to-split-the-text-into-two-columns-that-both-have-a-different-width%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

Mario Kart Wii

The Binding of Isaac: Rebirth/Afterbirth

What does “Dominus providebit” mean?