Comments (7)
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.
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.
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.
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.
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.
Wow, thanks @wg030 for the fast problem identification and fix!
from jlcode.
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)
- Tens of errors when used with other listings code HOT 2
- The \approx symbol not working HOT 2
- color of line numbers HOT 4
- Complex{Int64} problem HOT 2
- Error in compiling HOT 1
- Customize code block length HOT 2
- FR: Provide environment HOT 4
- Color of functions containing "!" HOT 4
- Line breaking is bad HOT 8
- Highlighting of macros HOT 4
- Avoid clutteting LaTeX project HOT 7
- Does not respect linewidth HOT 9
- Get utf-8 error with degree symbol HOT 7
- \approx error HOT 4
- Plenty of error messages involving xcolor HOT 7
- interaction with beamer overlays HOT 3
- \pm problems HOT 2
- Illegal parameter number in definition of \iterate HOT 2
- REPL format: Colorize `julia>` if any HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jlcode.