1

there is awesome multicol package. Question is - how to properly do \columnbreak to get elements aligned?

In other words:

  • any element type - paragraph, image, table
  • after \columnbreak command new column must created
  • and remaining elements in the second column to be aligned to the first element in first column

Similar to the tufte style, but layout should be strictly formalized.

Can someone help to get this behavior?

For example, in multicol package images after \columnbreak are not aligned to the first column.

demo on github with sample pdf

8
  • Isn't the main advantage of multicol that it works without manual \columnbreak? And are you sure that you are not looking for a package like parcolumn, parallel etc., if you would like to align text and pictures horizontaly? Or would you like to have a large second column to display tabluars, pictures and whatever to the main text, like here: tex.stackexchange.com/q/295864/4736 ?
    – Keks Dose
    Commented Sep 23, 2019 at 9:12
  • Thank you for the reference to the paracolumn -> paracol package. I am looking at them now. Commented Sep 23, 2019 at 10:03
  • @KeksDose paracol helps to explicitely break column (not always works in multicol package), but elements are not synchronized (at bottom) - there is an unnecessary space at the second column top. Commented Sep 23, 2019 at 11:09
  • 1
    You probably misunderstood the idea. I'd never use multicol and paracol. They are not meant to be compatible. Please edit your question: describe what you are trying to do and post a minimal working example, even if it doesn't quite work.
    – Keks Dose
    Commented Sep 23, 2019 at 11:12
  • @KeksDose Topic header contains goal description and referenced packages are possible independent solutions. Commented Sep 23, 2019 at 11:50

1 Answer 1

1

As I wrote in a comment, I guess the vertical shift is caused by the center environment.

For fun I tried to recycle my old post about having a two column document with marginnotes which are able to run over a pagebreak. To this end I had to externalise your tikzpicture and compile it separately. Code:

\documentclass{standalone}

\usepackage{tikz, adjustbox}
\graphicspath{ { . } }
\usetikzlibrary{matrix}


\begin{document}
%    \begin{adjustbox}{width=10cm}
    \begin{tikzpicture}
  \matrix (m) [matrix of math nodes, row sep=3em,
    column sep=3em]{
    & f^\ast E_V& & \vphantom{f^\ast}E_V \\
    f^\ast E & & \vphantom{f^\ast}E & \\
    & U & & V \\
    M & & N & \\};
  \path[-stealth]
    (m-1-2) edge (m-1-4) edge (m-2-1)
            edge [densely dotted] (m-3-2)
    (m-1-4) edge (m-3-4) edge (m-2-3)
    (m-2-1) edge [-,line width=6pt,draw=white] (m-2-3)
            edge (m-2-3) edge (m-4-1)
    (m-3-2) edge [densely dotted] (m-3-4)
            edge [densely dotted] (m-4-1)
    (m-4-1) edge (m-4-3)
    (m-3-4) edge (m-4-3)
    (m-2-3) edge [-,line width=6pt,draw=white] (m-4-3)
            edge (m-4-3);
\end{tikzpicture}
%    \end{adjustbox}}
\end{document}

OK, then lets see the main file:

\documentclass[parskip=full]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{scrlayer-scrpage, scrlayer-notecolumn, lmodern, blindtext,
ragged2e, graphicx, booktabs}


%% step 1: counter
\newcounter{snmark}
\setcounter{snmark}{0}


%% step 2: hanging sidenotes, definition from tugboat
\makeatletter
\newcommand*{\hangfrom}[1]{%
  \setbox\@tempboxa\hbox{{#1}}%
  \hangindent \wd\@tempboxa
  \noindent\box\@tempboxa}
\makeatletter

%% step 3: define sidenote marks in the text
\newcommand{\makesidenotemark}{%
  \textsuperscript{\thesnmark}%
}%


%% step 4: and now the definition of sidenotes
\newcommand{\sidenote}[2]{%
  \refstepcounter{snmark}% Zähler erhöhen
  %\makesidenotemark{}% Nummer im Text setzen.
  \makenote[paragraphs]{%
    \protect\Centering\detokenize{#1}\\
  \hangfrom{\textbf{Caption:~}} {#2}}% Text setzen im Rand
}


%% this is, except for the values (».7«) from scrguide.pdf to define
%% the notecolumn.


\newlength{\paragraphscolwidth}
\AfterCalculatingTypearea{%
\setlength{\paragraphscolwidth}{.4\textwidth}%
\addtolength{\paragraphscolwidth}{-\marginparsep}%
}
\recalctypearea
\DeclareNewNoteColumn[%
position=\oddsidemargin+1in
+.7\textwidth
+\marginparsep,
width=\paragraphscolwidth,
font=\footnotesize
]{paragraphs}

\usepackage{environ}
\makeatletter
\NewEnviron{margintable}{%
  \expandafter\@margintable\expandafter{\BODY}%
}
\newcommand*\@margintable[1]{%
  \makenote*[paragraphs]{%
    \begin{nonfloattable}#1\end{nonfloattable}%
  }%
}
\newenvironment{nonfloattable}{%
  \par\noindent\begin{minipage}{\linewidth}
    \def\@captype{table}%
}{%
  \end{minipage}\par
}
%\usepackage{makeidx}

%% Delete all sidenotes:
%\renewcommand{\sidenote}[1]{\relax}

\begin{document}
\begin{addmargin}[0pt]{.4\textwidth}
  lorem ipsum dolor sit
  amet\sidenote{\includegraphics[width=\paragraphscolwidth]{cat.jpg}}{A Whatever}, consectetur
  adipiscing elit. in eu fermentum mi, vel sagittis dolor. aenean nec leo sed justo
  varius egestas non nec lacus. fusce tortor nibh, porttitor a vestibulum sed,
  gravida eu nunc. aliquam tempor congue ipsum, eget vestibulum tortor volutpat
  dictum. phasellus rutrum justo at diam venenatis, sed porttitor risus
  pulvinar. in sit amet enim eros. donec semper vel justo ac lobortis. in hac
  habitasse platea dictumst.

  lorem ipsum dolor sit amet\sidenote{%
        \begin{tabular}{@{}llr@{}} \toprule
\multicolumn{2}{c}{Item} \\ \cmidrule(r){1-2}
Animal & Description & Price (\$)\\ \midrule
Gnat  & per gram  & 13.65 \\
& each      & 0.01 \\
Gnu   & stuffed   & 92.50 \\
Emu   & stuffed   & 33.33 \\
Armadillo & frozen & 8.99 \\ \bottomrule
\end{tabular}
  }{A tabular}, consectetur adipiscing elit. in eu fermentum mi, vel
  sagittis dolor. aenean nec leo sed justo varius egestas non nec lacus. fusce
  tortor nibh, porttitor a vestibulum sed, gravida eu nunc. aliquam tempor congue
  ipsum, eget vestibulum tortor volutpat dictum. phasellus rutrum justo at diam
  venenatis, sed porttitor risus pulvinar. in sit amet enim eros. donec semper vel
  justo ac lobortis. in hac habitasse platea dictumst.

  lorem ipsum dolor sit amet\sidenote{%
    \includegraphics[width=\paragraphscolwidth]{190920-standal}
    }{A Tikz picture loaded from a file}
  , consectetur adipiscing elit. in eu fermentum mi, vel
     sagittis dolor. aenean nec leo sed justo varius egestas non nec lacus. fusce
     tortor nibh, porttitor a vestibulum sed, gravida eu nunc. aliquam tempor congue
     ipsum, eget vestibulum tortor volutpat dictum. phasellus rutrum justo
     at diam venenatis, sed porttitor risus pulvinar. in sit amet enim eros. donec
     semper vel justo ac lobortis. in hac habitasse platea dictumst.
\end{addmargin}
\end{document}

Which renders: renderd picture of the code

2
  • Thank you for your reply. Looks very interesting. In my current doc table has a big space at the top (i had removed centering). So, problem is hard to solve without new commands writing (without \newcommand, etc)? Task is so easy, generally speaking. Commented Sep 23, 2019 at 14:19
  • @LexUshakov The table env is a float, tabular not. figure is a float as well, just use \includegraphics.
    – Keks Dose
    Commented Sep 23, 2019 at 14:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .