Aligning minicolumn with tcolorbox
Aligning minicolumn with tcolorbox
I'm trying to align two minipage environments to the page margins (the left minipage to the left margin and the right minipage to the right margin) but it does not seem to work. I also need a space between the two minipages and this is why I gave .45textwidth as parameter instead of .5textwidth to the minipage environments.
minipage
minipage
minipage
minipage
.45textwidth
.5textwidth
minipage
documentclass[10pt]article
usepackage[a4paper,top=15mm,bottom=10mm,left=15mm,right=15mm]geometry
usepackagetcolorbox
usepackagelipsum
begindocument
thispagestyleempty
beginminipage.45textwidth
raggedleft
begintcolorbox
centering
lipsum[1-2]
endtcolorbox
endminipage%
beginminipage.45textwidth
raggedright
begintcolorbox
centering
lipsum[3-4]
endtcolorbox
endminipage
enddocument
Could you please tell me how to align the columns?
Below is the output of my example:

2 Answers
2
Add hfill between the two minipages:
hfill
minipages
documentclass[10pt]article
usepackage[a4paper,top=15mm,bottom=10mm,left=15mm,right=15mm]geometry
usepackagetcolorbox
usepackagelipsum
begindocument
thispagestyleempty
beginminipage.45textwidth
raggedleft
begintcolorbox
centering
lipsum[1-2]
endtcolorbox
endminipage%
hfill
beginminipage.45textwidth
raggedright
begintcolorbox
centering
lipsum[3-4]
endtcolorbox
endminipage
enddocument

If you are using tcolorboxes, you can include them inside a tcbraster. By default columns are aligned to left a right margins and inter column space is 2mm, but you can change it with raster column skip value:
tcolorboxes
tcbraster
raster column skip
documentclass[10pt]article
usepackage[a4paper,top=15mm,bottom=10mm,left=15mm,right=15mm]geometry
usepackage[most]tcolorbox
usepackagelipsum
begindocument
thispagestyleempty
lipsum[1]
begintcbraster[raster columns=2, raster column skip=1cm]
begintcolorbox[halign=center]
lipsum[1-2]
endtcolorbox
begintcolorbox[halign=center]
lipsum[3-4]
endtcolorbox
endtcbraster
enddocument

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.