TransWikia.com

fitting tikz in two column document

TeX - LaTeX Asked by ADA on February 6, 2021

I have the following tikzcd diagrams in my two column document"

begin{center}
    begin{tikzcd}[column sep=20,row sep=20]
       P: prod_{i=1}^{WS}{G} arrow[r,"RTL"] & prod_{i=1}^{WS}{G} arrow[r,"TPL"] 
        & prod_{i=1}^{WS/2}{G} arrow[r,"RTL"] & ... arrow[r,"TPL"] & prod_{i=1}^{WS/8}{G} arrow[r,"RTL"] & prod_{i=1}^{WS/8}{G}
    end{tikzcd}
end{center}
begin{center}
    begin{tikzcd}[column sep=20,row sep=20]
       D: prod_{i=1}^{WS/8}{G} arrow[r,"RTL"] & prod_{i=1}^{WS/8}{G} arrow[r,"TUPL"] 
        & prod_{i=1}^{WS/4}{G} arrow[r,"RTL"] & ... arrow[r,"TUPL"] & prod_{i=1}^{WS}{G} arrow[r,"RTL"] & prod_{i=1}^{WS}{G}
    end{tikzcd}
end{center}

which span further than one column and is overwriting the next column, how can I either make the proceeding column to shift down or superimpose the tikz diagram across the whole page?

One Answer

This is one way.

1 You have to interrupt the multicols environment at the appropriate place and insert the diagrams.

2 Then increase manually the column sep until the diagram reaches textwidth. (They are to wide to fit in only one column)

3 Finally you add two to horizontal lines to mark the reading flow, otherwise the reader will be confused.

4 Restart the multicols.

documentclass[10pt]{article}
usepackage[
bottom=30mm,
top=30mm,
left=25mm,
right=25mm
]{geometry}

usepackage{lipsum}
usepackage{multicol}
usepackage{tikz}
usetikzlibrary{cd}

begin{document}

begin{multicols}{2}
    section{section 1}
    lipsum[1-9]        
section{section 2}
lipsum[1-2]
end{multicols}

noindentrule{textwidth}{0.5pt}

begin{center}
    begin{tikzcd}[column sep=40,row sep=20]
        P: prod_{i=1}^{WS}{G} arrow[r,"RTL"] & prod_{i=1}^{WS}{G} arrow[r,"TPL"] 
        & prod_{i=1}^{WS/2}{G} arrow[r,"RTL"] & ... arrow[r,"TPL"] & prod_{i=1}^{WS/8}{G} arrow[r,"RTL"] & prod_{i=1}^{WS/8}{G}
    end{tikzcd}
end{center}

begin{center}
    begin{tikzcd}[column sep=40,row sep=20]
        D: prod_{i=1}^{WS/8}{G} arrow[r,"RTL"] & prod_{i=1}^{WS/8}{G} arrow[r,"TUPL"] 
        & prod_{i=1}^{WS/4}{G} arrow[r,"RTL"] & ... arrow[r,"TUPL"] & prod_{i=1}^{WS}{G} arrow[r,"RTL"] & prod_{i=1}^{WS}{G}
    end{tikzcd}
end{center}
noindentrule{textwidth}{0.5pt}

begin{multicols}{2}   
    lipsum[1-2]
end{multicols}

end{document}

out6

A similar result is obtained using the figure environment. Makes the diagrams float, then they will be placed at the top of the page, if that what you wish. It might be a useful trick in some occasions. It will need a caption and a label to make a reference in the text.

The space between the blocks of text serves as a guide to the eye.

begin{figure}[t]
    begin{tikzcd}[column sep=40,row sep=20]
        P: prod_{i=1}^{WS}{G} arrow[r,"RTL"] & prod_{i=1}^{WS}{G} arrow[r,"TPL"] 
        & prod_{i=1}^{WS/2}{G} arrow[r,"RTL"] & ... arrow[r,"TPL"] & prod_{i=1}^{WS/8}{G} arrow[r,"RTL"] & prod_{i=1}^{WS/8}{G}
    end{tikzcd}    
caption{textbf{First diagram}} label{fig:D1}
end{figure}

begin{figure}[t]
    begin{tikzcd}[column sep=40,row sep=20]
        D: prod_{i=1}^{WS/8}{G} arrow[r,"RTL"] & prod_{i=1}^{WS/8}{G} arrow[r,"TUPL"] 
        & prod_{i=1}^{WS/4}{G} arrow[r,"RTL"] & ... arrow[r,"TUPL"] & prod_{i=1}^{WS}{G} arrow[r,"RTL"] & prod_{i=1}^{WS}{G}
    end{tikzcd}
    caption{textbf{Second diagram}} label{fig:D2}
end{figure}
begin{multicols}{2}   
    As the Diagram ref{fig:D1} shows, a more deeper approach is needed, like the chosen  in Diagram ref{fig:D2}.      
    
    lipsum[1-2]
end{multicols}

Add usepackage[figurename= Diagram]{caption} in the preamble.

ootFloat

Answered by Simon Dispa on February 6, 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