GithubHelp home page GithubHelp logo

Comments (7)

wg030 avatar wg030 commented on June 10, 2024 1

With my update from yesterday I did exactly what I described above and intended to do.

You don't even need a minipage anymore. The package should work with two (or even more) column documents automatically now.

from jlcode.

wg030 avatar wg030 commented on June 10, 2024 1

Well, this is tricky because switchting between one column and two columns is always not that easy.
Usually you would most likely go with the multicol package in that case. However if you are kind of restricted by a template that is a twocolumn documentclass, the best way I can think of is something like this:

\documentclass[twocolumn, 11pt, a4paper]{scrartcl}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{lipsum}
\usepackage{jlcode}

\begin{document}
\noindent
\lipsum[1-1][1-8]
\noindent
\begin{figure*}[htbp]
\begin{minipage}{\textwidth}
{\small
\begin{jllisting}
using DynamicalSystems
# some input data (chaotic Roessler system)
ds = Systems.roessler()
X  = trajectory(ds, 1000.0; Ttr = 1e3)
# Estimate correlation sum
es = estimate_boxsizes(X) # Sect. IV. A
Cs = boxed_correlationsum(X, es; q = 2)
# find and fit linear region
_, Delta = linear_region(log.(es), log.(Cs))
\end{jllisting}
}
\end{minipage}
\end{figure*}
\noindent
\lipsum[1-1][9-40]
\lipsum[2-9]
\end{document}

However, note that the listing is now a floating object and hence will be placed where the compiler thinks it fits best. I a two column document this is probably the top or the button of a page for short listings and a single page alone for long listings with a lot of lines of code.

from jlcode.

wg030 avatar wg030 commented on June 10, 2024

Hi @Datseris,
this looks ugly, of course. Could you provide the code for a complete minimal working example so that I can reproduce this problem?!

from jlcode.

Datseris avatar Datseris commented on June 10, 2024

Hi,

I am using the Chaos AIP template. Nevertheless something tells me this doesn't depend on the template and would be the same for any dual column document. I'm a bit busy now, when I have some spare time I can try to create a MWE. When I first posted this I was hoping whether there was some simple option I've missed...

from jlcode.

wg030 avatar wg030 commented on June 10, 2024

Well, it seems as if nobody has ever used that package in a two column document so far.
However, testing it with the scrartcl and the twocolumn option I could indeed easily create the same issue which means your guess that this has nothing to do with your template is very likely correct.
The good news is that it is as easy to fix: Just embed your listing into a minipage like this:

\documentclass[twocolumn, 11pt, a4paper]{scrartcl}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{lipsum}
\usepackage[charsperline=45]{jlcode}

\begin{document}
\noindent
\lipsum[1-1][1-8]
\noindent
\begin{minipage}{\columnwidth}
{\small
\begin{jllisting}
using DynamicalSystems
# some input data (chaotic Roessler system)
ds = Systems.roessler()
X  = trajectory(ds, 1000.0; Ttr = 1e3)
# Estimate correlation sum
es = estimate_boxsizes(X) # Sect. IV. A
Cs = boxed_correlationsum(X, es; q = 2)
# find and fit linear region
_, Delta = linear_region(log.(es), log.(Cs))
\end{jllisting}
}
\end{minipage}
\noindent
\lipsum[1-1][9-40]
\lipsum[2-4]
\end{document}

Note how I used the charsperline option to control the size of the codebox and how I also made use of the automatic font adjustment simply using \small in order to make the code fit into the column.
I also already know how to get rid of the minipage for the next future update which I am already working on and I will release soon. One simply needs to replace all \textwidth by \columnwidth in the jlcode.sty file and then everything should work even without a minipage.

from jlcode.

Datseris avatar Datseris commented on June 10, 2024

Wow, thanks @wg030 for the fast problem identification and fix!

from jlcode.

Datseris avatar Datseris commented on June 10, 2024

Hi, @wg030 , so the issue is now fixed! I came here with more like a question instead of opening a new issue, as I don't think this is an issue. My situation now is that I have a 2 column document, but my code is large. So I want to have a code using jlcode that spans two columns instead of one. Is this possible?

from jlcode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.